Closed javadbat closed 3 years ago
to make my problem clear my current solution is this:
but as I think set i18next.changeLanguage(lang);
is not a good idea because my whole node application language change on every request and it's CRAZY! I just want that specific request handled and rendered in lang and I don't want to change my entire i18n config for each request
I am not quite sure how this interacts with my module handlebars-i18n. What you could try if you have the user language stored in some variable like 'userLang' is to override the language of the generic request. Like so: {{__ myKey lng=userLang }}
. This will always give you the value for the key in user’s selected language, no matter how the generic request is set. Not sure if this is what you are looking for …
@fwalzel I'm also having the same issue but on a different context (too long to explain here). The main issue here is that we can have multiple instance of i18next but handlebars-i18n always assume the instance getting it from require('i18next')
here.
My suggestion is to allow override it passing the i18next
instance to init()
method.
Feature is now ready in v1.3.0. See readme.md under "Using custom instances of Handlebars"
first of all, thank you for your effort you put to maintain this repo its help me a lot my question is how can I change the render language base on the user setting? in our project, we keep user language in our cookie, and in every request, we get it like this: my question is how I can tell the handlebar to render the page base on lang variable thank you.