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:
commit
e860cd00a3
2 changed files with 9 additions and 2 deletions
|
@ -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 ?? ''));
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue