You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
Letter case in available language keys is sometimes ignored, behaviour is inconsistant.
When registering 'avaliable languages' such as (en_UK, de_DE) the letter case of the language returned when language is negotiated is inconsistant. It's sometimes en_UK, sometimes en_uk, depending on the way a match is found.
The language returned from $translate.use() should respect casing used when registering avaliable languages.
Actual behaviour
Depending on how matching is done in internal function 'negotiateLocale(preferred)', sometimes the letter case is respected, but sometimes not.
Fix
I've implemented a solution in pull request #1784 which passes the test in pull request #1783 and makes the returned language always respect case used when registering avaliable languages.
Why?!
The importance for this fix is more obvious if ngTranslate is used with the angular-translate-loader-static-files loader. Since the key/identifyer/language resolved by negotiateLocale() is used to determine which fileUrl is loaded, loading translations will fail if the server hosting the translations is case sensitive. This was how I originally found this bug.
The text was updated successfully, but these errors were encountered:
Letter case in available language keys is sometimes ignored, behaviour is inconsistant.
When registering 'avaliable languages' such as (en_UK, de_DE) the letter case of the language returned when language is negotiated is inconsistant. It's sometimes en_UK, sometimes en_uk, depending on the way a match is found.
Your environment
Steps to reproduce
Run the testcase supplied in pull request #1783 or look at this plunker https://plnkr.co/edit/5Eu5Qu0EXlBGd0ecigPg?p=preview
Expected behaviour
The language returned from $translate.use() should respect casing used when registering avaliable languages.
Actual behaviour
Depending on how matching is done in internal function 'negotiateLocale(preferred)', sometimes the letter case is respected, but sometimes not.
Fix
I've implemented a solution in pull request #1784 which passes the test in pull request #1783 and makes the returned language always respect case used when registering avaliable languages.
Why?!
The importance for this fix is more obvious if ngTranslate is used with the angular-translate-loader-static-files loader. Since the key/identifyer/language resolved by negotiateLocale() is used to determine which fileUrl is loaded, loading translations will fail if the server hosting the translations is case sensitive. This was how I originally found this bug.
The text was updated successfully, but these errors were encountered: