new-api/web/src/i18n/i18n.js

27 lines
547 B
JavaScript
Raw Normal View History

2024-12-12 23:32:55 +08:00
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import enTranslation from './locales/en.json';
import zhTranslation from './locales/zh.json';
2024-12-12 23:32:55 +08:00
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: {
en: {
2025-04-04 12:00:38 +08:00
translation: enTranslation,
},
zh: {
2025-04-04 12:00:38 +08:00
translation: zhTranslation,
},
2024-12-12 23:32:55 +08:00
},
fallbackLng: 'zh',
2024-12-12 23:32:55 +08:00
interpolation: {
2025-04-04 12:00:38 +08:00
escapeValue: false,
},
2024-12-12 23:32:55 +08:00
});
2025-04-04 12:00:38 +08:00
export default i18n;