MOBILE-2510 lang: Fix forcing default lang when wasn't needed

main
Dani Palou 2018-07-18 08:29:37 +02:00
parent 50637d0377
commit 4de2510140
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.