LanguageDetector does not respect browser's preferred language list. I know this seems like a duplicate, but issue persists (or I am doing something wrong!).
To Reproduce
The browser's ordered language list is de-AT, es-AR.
In the app, i18n.options.supportedLng = ["en", "es"] and i18n.options.fallbackLng = "en".
See below:
The app should render with i18n.language == "es-AR" and i18n.resolvedLanguage == "es", instead, the result is i18n.language == "de-AT and i18n.resolvedLanguage == "en". However, if "Spanish (Argentina)" is at the top of the browser's preferred language list, then the language is detected correctly (with i18n.language == "es-AR" and i18n.resolvedLanguage == "es").
After some choice log statements in LanguageDetector.detect() I found it puzzling that services.languageUtils.getBestMatchFromCodes(detected) returns "es-AR", but this value does not seemed to be used downstream.
Environment
browser: Version 96.0.4664.55
i18next: Version 21.6.11
os: macOS BigSur
🐛 Bug Report
LanguageDetector does not respect browser's preferred language list. I know this seems like a duplicate, but issue persists (or I am doing something wrong!).
To Reproduce
The browser's ordered language list is de-AT, es-AR.
In the app,
i18n.options.supportedLng = ["en", "es"]
andi18n.options.fallbackLng = "en"
. See below:Expected behavior
The app should render with
i18n.language == "es-AR"
andi18n.resolvedLanguage == "es"
, instead, the result isi18n.language == "de-AT
andi18n.resolvedLanguage == "en"
. However, if "Spanish (Argentina)" is at the top of the browser's preferred language list, then the language is detected correctly (withi18n.language == "es-AR"
andi18n.resolvedLanguage == "es"
).After some choice log statements in LanguageDetector.detect() I found it puzzling that
services.languageUtils.getBestMatchFromCodes(detected)
returns "es-AR", but this value does not seemed to be used downstream.Environment
browser: Version 96.0.4664.55 i18next: Version 21.6.11 os: macOS BigSur