[REGRESSION] Fallback language stopped working (#3072)
This commit is contained in:
parent
14078c0943
commit
f14868678b
|
@ -79,13 +79,16 @@ export const setLanguage = (l) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// server uses lowercase pattern (pt-br), but we're forced to use standard pattern (pt-BR)
|
// server uses lowercase pattern (pt-br), but we're forced to use standard pattern (pt-BR)
|
||||||
const locale = LANGUAGES.find(ll => ll.value.toLowerCase() === l.toLowerCase())?.value;
|
let locale = LANGUAGES.find(ll => ll.value.toLowerCase() === l.toLowerCase())?.value;
|
||||||
|
if (!locale) {
|
||||||
|
locale = 'en';
|
||||||
|
}
|
||||||
// don't go forward if it's the same language and default language (en) was setup already
|
// don't go forward if it's the same language and default language (en) was setup already
|
||||||
if (i18n.locale === locale && i18n.translations?.en) {
|
if (i18n.locale === locale && i18n.translations?.en) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i18n.locale = locale;
|
i18n.locale = locale;
|
||||||
i18n.translations = { ...i18n.translations, [locale]: translations[locale]() };
|
i18n.translations = { ...i18n.translations, [locale]: translations[locale]?.() };
|
||||||
I18nManager.forceRTL(isRTL(locale));
|
I18nManager.forceRTL(isRTL(locale));
|
||||||
I18nManager.swapLeftAndRightInRTL(isRTL(locale));
|
I18nManager.swapLeftAndRightInRTL(isRTL(locale));
|
||||||
i18n.isRTL = I18nManager.isRTL;
|
i18n.isRTL = I18nManager.isRTL;
|
||||||
|
|
Loading…
Reference in New Issue