Setting the language - server-side / client-side
-
Is there a way to set the NodeBB language in either the server or client js?
I have a cookie that contains the language code I want to set the forum to.
Is there a hook I can use on the server-side to set the language, or equally something on the client side I can use to change the locale?
Is there a way I can hook into the User's 'language' selector options to roll my own solution?
Note: passing
?lang=[LANGAUGE]
in the URL isn't an option
Note: Using the User settings isn't an option as I need to set the language before this point, from a CookieIs there a way to read cookies in the
middleware.autoLocale
function? (src/middleware/headers.js) req.cookies = {} at this point.
However, inside thefunction translate(str, req, res, next) {
req.cookies is a full object as I expect (src/middleware/render.js)Thanks!
-
@danlong you can override the userLang in
filter:config.get
, BTW noticereq.query.lang
in there, that's how?lang=
works. -
@danlong I believe it applies to all users
-