12345678910111213141516171819202122 |
- import i18n from 'i18next';
- import {initReactI18next} from 'react-i18next';
- // 导入本地语言包
- import en from './locales/en.json';
- import zh from './locales/zh.json';
- i18n
- .use(initReactI18next)
- .init({
- resources: {
- en: {translation: en},
- zh: {translation: zh},
- },
- lng: 'en', // 默认语言
- fallbackLng: 'en', // 找不到翻译时使用的语言
- interpolation: {
- escapeValue: false, // 防止 XSS(React 已经安全处理)
- },
- });
- export default i18n;
|