mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-02-05 21:20:08 +00:00
fix: prettier config
This commit is contained in:
24
src/i18n.js
24
src/i18n.js
@@ -1,9 +1,9 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import i18n from "i18next"
|
||||
import { initReactI18next } from "react-i18next"
|
||||
|
||||
import enTranslation from "./locales/en/translation.json";
|
||||
import zhCNTranslation from "./locales/zh-CN/translation.json";
|
||||
import zhTWTranslation from "./locales/zh-TW/translation.json";
|
||||
import enTranslation from "./locales/en/translation.json"
|
||||
import zhCNTranslation from "./locales/zh-CN/translation.json"
|
||||
import zhTWTranslation from "./locales/zh-TW/translation.json"
|
||||
|
||||
const resources = {
|
||||
en: {
|
||||
@@ -15,11 +15,11 @@ const resources = {
|
||||
"zh-TW": {
|
||||
translation: zhTWTranslation,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const getStoredLanguage = () => {
|
||||
return localStorage.getItem("language") || "zh-CN";
|
||||
};
|
||||
return localStorage.getItem("language") || "zh-CN"
|
||||
}
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
@@ -28,11 +28,11 @@ i18n.use(initReactI18next).init({
|
||||
interpolation: {
|
||||
escapeValue: false, // react已经安全地转义
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// 添加语言改变时的处理函数
|
||||
i18n.on("languageChanged", (lng) => {
|
||||
localStorage.setItem("language", lng);
|
||||
});
|
||||
localStorage.setItem("language", lng)
|
||||
})
|
||||
|
||||
export default i18n;
|
||||
export default i18n
|
||||
|
||||
Reference in New Issue
Block a user