[FIX] Language country has been ignored on translation load (#16757)

* [FIX] Language country has been ignored on translation load

* Enforce uppercase country on filterLanguage method and change the language list to list with uppercase countries
pull/16752/head^2
Rodrigo Nascimento 5 years ago committed by GitHub
parent 67989df567
commit b743e157f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/ui-account/client/accountPreferences.js
  2. 2
      client/startup/i18n.js

@ -49,7 +49,7 @@ Template.accountPreferences.helpers({
const languages = TAPi18n.getLanguages();
const result = Object.entries(languages)
.map(([key, language]) => ({ ...language, key: key.toLowerCase() }))
.map(([key, language]) => ({ ...language, key }))
.sort((a, b) => a.key - b.key);
result.unshift({
@ -62,7 +62,7 @@ Template.accountPreferences.helpers({
},
isUserLanguage(key) {
const languageKey = Meteor.user().language;
return typeof languageKey === 'string' && languageKey.toLowerCase() === key;
return typeof languageKey === 'string' && languageKey.toLowerCase() === key.toLowerCase();
},
ifThenElse(condition, val, not = '') {
return condition ? val : not;

@ -21,7 +21,7 @@ Meteor.startup(() => {
const regex = /([a-z]{2,3})-([a-z]{2,4})/;
const matches = regex.exec(language);
if (matches) {
return `${ matches[1] }-${ matches[2].toLowerCase() }`;
return `${ matches[1] }-${ matches[2].toUpperCase() }`;
}
return language;

Loading…
Cancel
Save