UNPKG

@lonu/stc

Version:

A tool for converting OpenApi/Swagger/Apifox into code.

21 lines (20 loc) 525 B
import i18next from "i18next"; import enTranslation from "./locales/en.js"; import zhCNTranslation from "./locales/zh-CN.js"; const locale = Intl.DateTimeFormat().resolvedOptions().locale; i18next.init({ resources: { en: { translation: enTranslation, }, "zh-CN": { translation: zhCNTranslation, }, }, interpolation: { escapeValue: false, }, }); const i18n = (lng) => i18next.getFixedT(lng || locale); const getT = i18n(); export { getT, i18n };