mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Merge pull request #938 from sorin-davidoi/lang-respect-fallbacks
fix(lang): respect fallback languages
This commit is contained in:
commit
2e83df6f25
1 changed files with 4 additions and 3 deletions
|
@ -1,9 +1,9 @@
|
||||||
import { i18n } from '@lingui/core';
|
import { i18n } from '@lingui/core';
|
||||||
import {
|
import {
|
||||||
detect,
|
|
||||||
fromNavigator,
|
fromNavigator,
|
||||||
fromStorage,
|
fromStorage,
|
||||||
fromUrl,
|
fromUrl,
|
||||||
|
multipleDetect,
|
||||||
} from '@lingui/detect-locale';
|
} from '@lingui/detect-locale';
|
||||||
import Locale from 'intl-locale-textinfo-polyfill';
|
import Locale from 'intl-locale-textinfo-polyfill';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export async function activateLang(lang) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initActivateLang() {
|
export function initActivateLang() {
|
||||||
const lang = detect(
|
const languages = multipleDetect(
|
||||||
fromUrl('lang'),
|
fromUrl('lang'),
|
||||||
fromStorage('lang'),
|
fromStorage('lang'),
|
||||||
fromNavigator(),
|
fromNavigator(),
|
||||||
|
@ -62,7 +62,8 @@ export function initActivateLang() {
|
||||||
DEFAULT_LANG,
|
DEFAULT_LANG,
|
||||||
);
|
);
|
||||||
const matchedLang =
|
const matchedLang =
|
||||||
ALL_LOCALES.find((l) => l === lang) || localeMatch(lang, ALL_LOCALES);
|
languages.find((l) => ALL_LOCALES.includes(l)) ||
|
||||||
|
localeMatch(languages, ALL_LOCALES);
|
||||||
activateLang(matchedLang);
|
activateLang(matchedLang);
|
||||||
|
|
||||||
// const yes = confirm(t`Reload to apply language setting?`);
|
// const yes = confirm(t`Reload to apply language setting?`);
|
||||||
|
|
Loading…
Reference in a new issue