i18n-helper-babel
Version:
i18n 命令行工具。一键包裹,提取,翻译,统计。支持网页截图,翻译词条检测
26 lines (20 loc) • 611 B
text/typescript
import i18next from 'i18next';
import Backend from 'i18next-fs-backend';
import { parseI18nConf } from './util/fileHelper';
const i18nConf = parseI18nConf(undefined, undefined, false);
i18next.use(Backend).init({
// debug: true,
initImmediate: false,
lng: i18nConf?.cliLang ?? 'zh',
ns: i18nConf?.transFileName ?? 'translation',
fallbackLng: 'en',
backend: { loadPath: './src/locales/{{lng}}/{{ns}}.json' },
interpolation: {
escapeValue: false,
},
});
// eslint-disable-next-line import/no-mutable-exports
let { t } = i18next;
t = t.bind(i18next);
export default i18next;
export { t };