Closed mitchobrian closed 4 years ago
and what should "example.de/blog/post1" get?
there is no validation...either you have languages in path / or not -> be consistent
and what should "example.de/blog/post1" get?
it should get blog and this should be invalid because it's no language - so then I expected the cookie will be selected or we use the fallback.
there is no validation...either you have languages in path / or not -> be consistent
consistency is always good ;) but I just think about to have a complete page merged with a blog which isn't language dependent.
I think, It should at least fallback to your fallbackLng... isn't this the case?
I think, It should at least fallback to your fallbackLng... isn't this the case?
Unfortunately no, it recognizes "blog" as a path.
Yes, this is expected. But my question was: which language is shown in your app? because lng=blog can not be found i18next should use your fallbackLng (i18next option)
Yes, this is expected. But my question was: which language is shown in your app? because lng=blog can not be found i18next should use your fallbackLng (i18next option)
Ah okay, it falls back properly to de. But the var i18next.language is set to blog - how can I fix this?
there are two things:
i18next.language -> always what comes from detector and was saved to any detector cache
i18next.languages -> an array of languages that are use to lookup translations -> in your case ['blog', 'fallback']
But i18next.languages should just expect: ["de", "en"]
no, i18next.languages are all languages to lookup the translation... blog is the one detected by the language detector, and de is your fallbackLng, so ["blog", "de"]...
try to set checkWhitelist to true and define a whitelist
try to set checkWhitelist to true and define a whitelist
Thanks a lot! That exactly what i was looking for! https://github.com/i18next/i18next-browser-languageDetector/issues/148#issuecomment-353372087
I have searched a lot but nothing found. Could you provide me an example for how to validate the pattern from path.
Example: example.de/de/team should get de Example: example.de/en-EN/team should get de-EN But Example: example.de/blog/post1 shouldn' get blog
I need a validation in changeLanguage to check if the read path is a correct lang.