0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00

Merge pull request #716 from logto-io/charles-log-2266-integrate-language-settings

feat(console): integrate language settings
This commit is contained in:
Charles Zhao 2022-05-03 01:50:16 +08:00 committed by GitHub
commit e860cd00a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -53,6 +53,12 @@ const Main = () => {
};
}, [data?.adminConsole.appearanceMode]);
useEffect(() => {
(async () => {
void initI18n(data?.adminConsole.language);
})();
}, [data?.adminConsole.language]);
useEffect(() => {
if (location.pathname === '/') {
navigate(getPath(sections[0]?.items[0]?.title ?? ''));

View file

@ -1,9 +1,9 @@
import resources from '@logto/phrases';
import resources, { Language } from '@logto/phrases';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
const initI18n = async () =>
const initI18n = async (language?: Language) =>
i18next
.use(initReactI18next)
.use(LanguageDetector)
@ -13,6 +13,7 @@ const initI18n = async () =>
interpolation: {
escapeValue: false,
},
lng: language,
});
export default initI18n;