How to change locale through the language picker
See original GitHub issueThis is my configuration but locale doesn’t change, if I change defalutLocale in initial configuration webpage is translated. But if I pick different language from the dropdown nothing changes
i18n.configure({
locales: ['eng', 'rus'],
defaultLocale: 'rus',
directory: __dirname + '/static/locales',
cookiename: 'locale'
});
app.use(function (req, res, next) {
res.locals.__ = res.__ = function() {
return i18n.__.apply(req, arguments);
};
next();
});
app.get('/:locale', function (req, res) {
res.cookie('locale', req.params.locale);
i18n.setLocale(i18n, req.params.locale);
res.redirect(req.headers.referer);
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to change the Language Locale of an individual User ...
Answer: · 1. Click Management · 2. Click My User · 3. Click Preferences · 4. Click the Locale drop-down · 5. Select...
Read more >JavaFX: How to Change the Locale in JFXDatePicker
Short Answer: Use Locale.setDefault(Locale newLocale); (if that's possible in your application). I am not sure if the Uzbek language has a ...
Read more >How to change Language, Time, Region, Locale settings in ...
Time and Language Settings in Windows 10 consist of all the settings that allow you to set your date and time, time zone,...
Read more >How to Change System Locale on Windows 10 - YouTube
Steps-1. Go into settings2. Type in control panel3. Select "Clock, Language and Region".4. Select "region"5. Go to the administrative tab6.
Read more >Visual Studio Code Display Language (Locale)
You can also override the default UI language by explicitly setting the VS Code display language using the Configure Display Language command. Press...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
haha I didn’t spot that either… cookie vs. cookiename - the later is more explicit => thinking of an alias…
hbs helpers are always tricky to implement as they maintain their own scope[s] in nested levels. I recently setup some helpers by use of
this.__()
in helper methods. Beware that this will only work on @root level in hbs:setup express app
and a helper module combining all of my helpers:
so a view could read like so: