-
-
Notifications
You must be signed in to change notification settings - Fork 202
Bug: getBrowserCultureLang() is not working as expected in all browsers #472
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
Comments
@MickL Can you please provide the browser versions that you tested this issue on? |
Latest versions everywhere: Chrome 91.0.4472.164 |
This issue is still open and reproducible with current browsers and transloco/transloco-locale versions. Are there any fixes available @shaharkazaz? |
@dvdvnl Currently no. |
... should yield consistent results across browsers. Well, at least Chrome/Firefow/Safari |
After @rraziel opened the PR, I started digging deeper into the issue. The main problem isn't browser consistency— all the values emitted by the browsers are valid, as they follow BCP 47. Both Safari and Chrome produce the same values, which makes sense because according to this section of BCP 47:
In other words, everything is case insensitive. Firefox is also valid, as this section clarifies:
One subtag (the primary language in this case) is valid and is listed in the appendix. This brings me to a few key points:
To resolve this issue, I'll update the BCP 47 validator to correctly validate the format. |
Uh oh!
There was an error while loading. Please reload this page.
Current behavior
Using
getBrowserCultureLang()
returns:The problem gets worse when using
transloco-locale
:-> Throws "de isn't a valid locale format"
Expected behavior
Should always return correct format 'de-DE'
Minimal reproduction of the problem with instructions
Environment
The text was updated successfully, but these errors were encountered: