0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-27 21:39:16 -05:00

feat(console): integrate admin console language settings

This commit is contained in:
Charles Zhao 2022-04-30 09:36:51 +08:00
parent a04f818ffb
commit 048290b49f
No known key found for this signature in database
GPG key ID: 4858774754C92DF2
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;