i18n.ts 414 B

12345678910111213141516171819
  1. // src/i18n.ts
  2. import i18next from 'i18next';
  3. import Backend from 'i18next-http-backend';
  4. i18next
  5. .use(Backend)
  6. .init({
  7. lng: 'zh', // 默认语言
  8. fallbackLng: 'en', // 回退语言
  9. debug: true, // 开启调试模式
  10. backend: {
  11. loadPath: '/assets/locales/{{lng}}/{{ns}}.json',
  12. },
  13. interpolation: {
  14. escapeValue: false, // 不需要转义
  15. },
  16. });
  17. export default i18next;