i18n-node icon indicating copy to clipboard operation
i18n-node copied to clipboard

[Feature Request] Client-side library

Open tomkit opened this issue 12 years ago • 9 comments

I like the flexible singular/plural API. It's great for node on the server side, but it'd be super nice to be able to re-use the mappings produced in en.js on the client side too with a port of the node library to a client library.

tomkit avatar Aug 23 '12 20:08 tomkit

+1

MaksJS avatar Sep 05 '12 19:09 MaksJS

I want it too !

loicguillois avatar Nov 21 '12 10:11 loicguillois

me too :)

mashpie avatar Dec 07 '12 11:12 mashpie

+1

luto avatar Feb 26 '13 15:02 luto

Let's have a look at asset-rack. With that module, you can serve pre-compiled Jade templates to the client. With the help of @techpines, we will be able to translate i18n strings for the client through Jade templates : https://github.com/techpines/asset-rack/issues/42#issuecomment-14415554 Seems better than a client library cause it's pre-compiled

MaksJS avatar Mar 05 '13 00:03 MaksJS

Couldnt you simply add the entire resource JSON into the template as a local variable, and transport that as as String to be used in the client side? Then you obviously would need a function similar to the one used in server-side/templating.

At least thats what I am doing.

Obviously, you may need to implement the fallback logic, so, you will have to at maximum two resource JSON files.

Previously, I was doing an ajax to obtain the resource files. But I thought it was unnecessary.

lagoasoft-lucasschmidt avatar Nov 11 '13 19:11 lagoasoft-lucasschmidt

In case your frontend application uses Angular, you might like https://github.com/oliversalzburg/ng-i18n-node. We use this in our Cordova application.

oliversalzburg avatar Oct 01 '14 12:10 oliversalzburg

+1

martingg88 avatar Jul 07 '15 04:07 martingg88

+1

scazzy avatar Jun 20 '17 14:06 scazzy