Question

I was wondering how one could manually change the locale for a SailsJS app. What I am envisioning is having a dropdown on the top nav bar from which the user can change the language that they want the site to be displayed in.

Mike

Was it helpful?

Solution

you'll have to adapt your config/i18n.js in the sails project to configure your locales, default locale, and perhaps a custom cookie name.

Then you can use setLocale('myLocaleName') to set the locale based on what gets selected in your dropdown. The link provides a detailed description on how to do this.

Good luck

Daniel

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top