From 4de251014025eb43452b3ce969f0e86a3f8e2bd2 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 18 Jul 2018 08:29:37 +0200 Subject: [PATCH] MOBILE-2510 lang: Fix forcing default lang when wasn't needed --- src/providers/lang.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/providers/lang.ts b/src/providers/lang.ts index a4821245d..363a245cd 100644 --- a/src/providers/lang.ts +++ b/src/providers/lang.ts @@ -173,7 +173,7 @@ export class CoreLangProvider { return language; }).catch(() => { // 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; } @@ -190,6 +190,11 @@ export class CoreLangProvider { } } + if (typeof CoreConfigConstants.languages[language] == 'undefined') { + // Language not supported, use fallback language. + return this.fallbackLanguage; + } + return language; }).catch(() => { // Error getting locale. Use default language.