I need use i18n() in my code inside of assets/js of my sailsjs project. How can i to do it?
In my views is ok but in my js not, why?
thanks you very much.
I have [email protected]
What I do, is download the translations from the server and use them client side. I never hardcode translations in my assets and I wouldn't if I were you either.
Add a route to fetch your translations (static json) and parse the JSON client side. There are plenty of libraries that can help you from there.
Keep in mind that it's always possible to include translations in a build for something like require.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With