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

fix(console): language auto detection

This commit is contained in:
Charles Zhao 2022-07-07 19:34:33 +08:00
parent 78cba36e8f
commit 7c880fc3e6
No known key found for this signature in database
GPG key ID: 4858774754C92DF2

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;