Files
Termix/src/i18n/i18n.ts
2025-11-10 00:47:05 +01:00

59 lines
1.3 KiB
TypeScript

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";
import deTranslation from "../locales/de/translation.json";
import ptbrTranslation from "../locales/pt-BR/translation.json";
import ruTranslation from "../locales/ru/translation.json";
import frTranslation from "../locales/fr/translation.json";
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
supportedLngs: ["en", "zh", "de", "ptbr", "ru"],
fallbackLng: "en",
debug: false,
detection: {
order: ["localStorage", "cookie"],
caches: ["localStorage", "cookie"],
lookupLocalStorage: "i18nextLng",
lookupCookie: "i18nextLng",
checkWhitelist: true,
},
resources: {
en: {
translation: enTranslation,
},
zh: {
translation: zhTranslation,
},
de: {
translation: deTranslation,
},
ptbr: {
translation: ptbrTranslation,
},
ru: {
translation: ruTranslation,
},
fr: {
translation: frTranslation,
},
},
interpolation: {
escapeValue: false,
},
react: {
useSuspense: false,
},
});
export default i18n;