-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrectly forcing the selection of a language #254
Comments
Yeah I see i've introduced a regression when fixing the RT feature. Will have a look at how to so it differently |
As said in #234 : It is a blocking issue for browser language detection, which I guess everyone who wants to internationalize its app wants too... |
A workaround is: .plugin('aurelia-i18n', instance => {
let aliases = ['t', 'i18n'];
TCustomAttribute.configureAliases(aliases);
instance.i18next
.use(Backend)
.use(LngDetector);
return instance.setup({
backend: {
loadPath: './locales/{{lng}}/{{ns}}.json'
},
lng: 'en',
detection: {
order: ['navigator'], // Enforce navigator language detection
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
caches: ['localStorage', 'cookie']
},
attributes: aliases,
fallbackLng: 'en',
debug: environment.debug
})
.then(() => {
// Enforce language detection
instance.i18next.changeLanguage();
});
}) Calling Alternatively, and I think it is a better workaround, you can change detection: {
order: ['localStorage', 'cookie', 'navigator'],
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
caches: [] // Enforce no detection caching
} In that case detection reads cached language but do not writes in cache so you have to set it by yourself in HTH |
stops forcing the lng option in favor of relativetime and uses the fallbackLng instead Related issue #254
Alright sorry for taking me so long to fix this but I think I got it with the recent PR #259. Just waiting for it to properly build and after merge we'll hopefully get a quick release out. |
stops forcing the lng option in favor of relativetime and uses the fallbackLng instead Related issue #254
The new Release has been pushed, may I ask you guys to check out whether now everything runs as expected? |
Thanks @zewa666! All seems ok for me! 😃 |
Thanks for the quick response. Im gonna close this for now and we can reopen the issues If any other troubles occur. |
i18n/src/i18n.js
Line 38 in 702b2bc
The plugin should not force a lng option. When using a detector, this would be dynamically resolved, by forcing this option, it prevents the detector from doing its job. If anything, the fallback language should be forced.
The text was updated successfully, but these errors were encountered: