It depends on which version of Sails you are using.
For Sails v0.12.x, the only way to specify a dynamic language is to use a dictionary as an argument to sails.__ :
sails.__({ phrase: 'Welcome', locale: 'fr' })
will provide you with Bienvenue using the default Sails app.
This syntax is not available in Sails 1.0, but you can change the current language using sails.hooks.i18n.setLocale() :
var curLocale = sails.hooks.i18n.getLocale(); sails.hooks.i18n.setLocale('fr'); sails.__('Welcome'); sails.hooks.i18n.setLocale(curLocale);
will again provide you with Bienvenue using the default Sails application, ensuring that after that the locale will revert to the default. This way you do not accidentally change the locale for all subsequent __ calls.
source share