Sails.js: how to use i18n function in assets/js/files.js

La mujer esponja

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]

4Dev

I agree with Wesley, but if you don't want all of the translations client side. I would suggest writing an Ajax call and make use of the following:

sails.__({
  phrase: 'Good day',
  locale: 'de'
});

This should then be returned as the German version of 'Good day'. Or you can just send the key phrase and return all your language translations of that.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related