0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00
logto/packages/demo-app/src/i18n/init.ts

20 lines
527 B
TypeScript

import type { LanguageTag } from '@logto/language-kit';
import resources from '@logto/phrases';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
const initI18n = async (language?: LanguageTag) =>
i18next
.use(initReactI18next)
.use(LanguageDetector)
.init({
resources,
fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
lng: language,
});
export default initI18n;