1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-17 04:30:31 +09:00
namae/setupTests.ts

31 lines
817 B
TypeScript
Raw Permalink Normal View History

2019-08-03 00:35:23 +09:00
// this adds jest-dom's custom assertions
2020-08-31 08:41:53 +09:00
import '@testing-library/jest-dom/extend-expect';
2019-08-14 18:46:57 +09:00
// i18next
2020-08-31 08:41:53 +09:00
import { join } from 'path';
import i18n from 'i18next';
2022-03-09 15:16:54 +09:00
import Backend from 'i18next-chained-backend';
import NodeFs from 'i18next-node-fs-backend';
2020-08-31 08:41:53 +09:00
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
2019-08-14 18:46:57 +09:00
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
backend: {
2022-03-09 15:16:54 +09:00
backends: [NodeFs],
backendOptions: [
{ loadPath: join(__dirname, '../public/locales/{{lng}}/{{ns}}.json') },
],
2019-08-14 18:46:57 +09:00
},
fallbackLng: 'en',
ns: ['translation'],
defaultNS: 'translation',
debug: false,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
2020-08-31 08:41:53 +09:00
});