0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

Merge pull request #1456 from logto-io/charles-log-3476-fix-admin-console-default-languge-detection

fix(console): language auto detection
This commit is contained in:
Charles Zhao 2022-07-07 21:43:01 +08:00 committed by GitHub
commit a0936f3b03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import resources, { Language } from '@logto/phrases';
import { conditional } from '@silverhand/essentials';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
@ -13,11 +14,11 @@ const initI18n = async (language?: Language) =>
interpolation: {
escapeValue: false,
},
lng: language,
detection: {
lookupLocalStorage: 'i18nextLogtoAcLng',
lookupSessionStorage: 'i18nextLogtoAcLng',
},
...conditional(language && { lng: language }),
});
export default initI18n;