Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
fix(service): ignore case when matching wildcards in available langua…
Browse files Browse the repository at this point in the history
…ges map

By ignoring case in language map wildcards, there is no longer any need for redundant
entries covering every single combination for each language. I.e. 'en_*' will match 'En-UK',
'eN_UK' as well as 'EN_UK'.

Relates #1789
  • Loading branch information
Karl Berggren authored and knalli committed Oct 3, 2017
1 parent 8fb6f5d commit 7f25843
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvide
angular.lowercase(langKeyAlias) === angular.lowercase(preferred);

if (langKeyAlias.slice(-1) === '*') {
hasWildcardKey = langKeyAlias.slice(0, -1) === preferred.slice(0, langKeyAlias.length - 1);
hasWildcardKey = angular.lowercase(langKeyAlias.slice(0, -1)) === angular.lowercase(preferred.slice(0, langKeyAlias.length - 1));
}
if (hasExactKey || hasWildcardKey) {
alias = $languageKeyAliases[langKeyAlias];
Expand Down

0 comments on commit 7f25843

Please sign in to comment.