Files
behavior3editor/src/misc/i18n.ts
T
codetypes 2e5c08b2ad reimplement the editor use lastest antd and other libs, feature of this commit:
1. file manger
2. highlight for click input or output
3. selector of subtress
4. autocomplete for input or output
2024-04-17 10:35:51 +08:00

46 lines
958 B
TypeScript

import dayjs from "dayjs";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import HttpApi from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
declare module "i18next" {
interface CustomTypeOptions {
returnNull: false;
}
}
i18n
.use(LanguageDetector)
.use(initReactI18next)
.use(HttpApi)
.init(
{
debug: import.meta.env.NODE_ENV === "development",
returnNull: false,
fallbackLng: "en",
interpolation: {
escapeValue: false,
},
react: {
useSuspense: false,
},
load: "languageOnly",
detection: {
caches: ["localStorage", "sessionStorage", "cookie"],
},
backend: {
loadPath: `locales/{{lng}}.json`,
},
},
function (err, t) {
dayjs.locale(i18n.language);
}
);
i18n.on("languageChanged", (lng) => {
dayjs.locale(lng);
});
export default i18n;