2025-09-28 20:47:44 +08:00
|
|
|
import i18n from "i18next";
|
|
|
|
|
import { initReactI18next } from "react-i18next";
|
|
|
|
|
|
|
|
|
|
import en from "./locales/en.json";
|
|
|
|
|
import zh from "./locales/zh.json";
|
|
|
|
|
|
|
|
|
|
const resources = {
|
|
|
|
|
en: {
|
|
|
|
|
translation: en,
|
|
|
|
|
},
|
|
|
|
|
zh: {
|
|
|
|
|
translation: zh,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
i18n.use(initReactI18next).init({
|
|
|
|
|
resources,
|
2025-09-28 21:11:22 +08:00
|
|
|
lng: "zh", // 默认语言调整为中文
|
|
|
|
|
fallbackLng: "en", // 如果缺少中文翻译则退回英文
|
2025-09-28 20:47:44 +08:00
|
|
|
|
|
|
|
|
interpolation: {
|
|
|
|
|
escapeValue: false, // React 已经默认转义
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 开发模式下显示调试信息
|
|
|
|
|
debug: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default i18n;
|