default to english as primary locale
This commit is contained in:
parent
13708ab052
commit
f6944fbbea
1 changed files with 2 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import en from '@assets/i18n/en.json';
|
|||
import availableLanguages from './languages';
|
||||
|
||||
const deviceLocale = getLocales()[0].languageTag;
|
||||
const PRIMARY_LOCALE = 'en';
|
||||
export const DEFAULT_LOCALE = getLocaleFromLanguage(deviceLocale);
|
||||
|
||||
function loadTranslation(locale?: string) {
|
||||
|
|
@ -201,7 +202,7 @@ function loadChinesePolyfills() {
|
|||
|
||||
export function getLocaleFromLanguage(lang: string) {
|
||||
const languageCode = lang.split('-')[0];
|
||||
const locale = availableLanguages[lang] || languageCode;
|
||||
const locale = availableLanguages[lang] || availableLanguages[languageCode] || PRIMARY_LOCALE;
|
||||
return locale;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue