You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm following the i18n example and makara 2.0 blog post / docs. but I'm not able to override the fallback locale in my kraken. Probably I'm missing something.
I have my middleware to read locale from cookies and setting it in the res.locals.locale and req.locale .
'use strict';varbcp47=require('bcp47');module.exports=function(){returnfunction(req,res,next){varlocale=req.cookies&&req.cookies.locale;//Set the locality for this response. The template will pick the appropriate bundleres.locals.locale=req.locale=bcp47.parse(locale);//res.locals.locale = req.locale = locale //I have tried also this next();};};
The middleware works fine, and sets res.locals.locale and req.locale to the bcp47 object according to the locale cookie value.
But on the template rendering I always get the default locale message, and not my localized message taken from the correct .properties files.
I'm missing something or does it looks correct?
The text was updated successfully, but these errors were encountered:
Hi, I'm following the i18n example and makara 2.0 blog post / docs. but I'm not able to override the fallback locale in my kraken. Probably I'm missing something.
I have my middleware to read locale from cookies and setting it in the res.locals.locale and req.locale .
And in my config.json I have:
I have declared a route to set locale cookie into my index.js controller (usage eg: /setLanguage/EN-us )
The middleware works fine, and sets res.locals.locale and req.locale to the bcp47 object according to the locale cookie value.
But on the template rendering I always get the default locale message, and not my localized message taken from the correct .properties files.
I'm missing something or does it looks correct?
The text was updated successfully, but these errors were encountered: