Files
Termix/src/i18n/i18n.ts
T

43 lines
883 B
TypeScript
Raw Normal View History

2025-09-12 14:42:00 -05:00
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import enTranslation from "../locales/en/translation.json";
import zhTranslation from "../locales/zh/translation.json";
2025-09-03 00:14:49 -05:00
i18n
2025-09-12 14:42:00 -05:00
.use(LanguageDetector)
.use(initReactI18next)
2025-09-03 00:14:49 -05:00
.init({
2025-09-12 14:42:00 -05:00
supportedLngs: ["en", "zh"],
fallbackLng: "en",
2025-09-03 00:14:49 -05:00
debug: false,
2025-09-12 14:42:00 -05:00
2025-09-03 00:14:49 -05:00
detection: {
2025-09-12 14:42:00 -05:00
order: ["localStorage", "cookie"],
caches: ["localStorage", "cookie"],
lookupLocalStorage: "i18nextLng",
lookupCookie: "i18nextLng",
2025-09-03 00:14:49 -05:00
checkWhitelist: true,
},
2025-09-12 14:42:00 -05:00
resources: {
en: {
translation: enTranslation,
},
zh: {
translation: zhTranslation,
},
2025-09-03 00:14:49 -05:00
},
2025-09-12 14:42:00 -05:00
2025-09-03 00:14:49 -05:00
interpolation: {
2025-09-12 14:42:00 -05:00
escapeValue: false,
2025-09-03 00:14:49 -05:00
},
2025-09-12 14:42:00 -05:00
2025-09-03 00:14:49 -05:00
react: {
2025-09-12 14:42:00 -05:00
useSuspense: false,
2025-09-03 00:14:49 -05:00
},
});
2025-09-12 14:42:00 -05:00
export default i18n;