config.ts 550 B

12345678910111213141516171819
  1. import i18n from 'i18next';
  2. import { initReactI18next } from 'react-i18next';
  3. import resourcesToBackend from 'i18next-resources-to-backend';
  4. import { supportedLocales } from './locales';
  5. import { defaultLocale } from './types';
  6. i18n
  7. .use(initReactI18next)
  8. .use(resourcesToBackend((language: string) => import(`./locales/${language}.json`)))
  9. .init({
  10. lng: defaultLocale,
  11. fallbackLng: defaultLocale,
  12. supportedLngs: supportedLocales.map((l) => l.code),
  13. interpolation: {
  14. escapeValue: false,
  15. },
  16. });
  17. export default i18n;