Merge pull request #1414 from dpalou/MOBILE-2510

MOBILE-2510 lang: Fix forcing default lang when wasn't needed
main
Juan Leyva 2018-07-18 10:40:47 +02:00 committed by GitHub
commit 72162667b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -173,7 +173,7 @@ export class CoreLangProvider {
return language; return language;
}).catch(() => { }).catch(() => {
// User hasn't defined a language. If default language is forced, use it. // User hasn't defined a language. If default language is forced, use it.
if (CoreConfigConstants.default_lang && !CoreConfigConstants.forcedefaultlanguage) { if (CoreConfigConstants.default_lang && CoreConfigConstants.forcedefaultlanguage) {
return CoreConfigConstants.default_lang; return CoreConfigConstants.default_lang;
} }
@ -190,6 +190,11 @@ export class CoreLangProvider {
} }
} }
if (typeof CoreConfigConstants.languages[language] == 'undefined') {
// Language not supported, use fallback language.
return this.fallbackLanguage;
}
return language; return language;
}).catch(() => { }).catch(() => {
// Error getting locale. Use default language. // Error getting locale. Use default language.