i18n-node
i18n-node copied to clipboard
[Feature Request] Client-side library
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.
+1
I want it too !
me too :)
+1
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
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.
In case your frontend application uses Angular, you might like https://github.com/oliversalzburg/ng-i18n-node. We use this in our Cordova application.
+1
+1