1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 14:20:03 +09:00
namae/src/util/i18n.ts

31 lines
778 B
TypeScript
Raw Normal View History

2019-09-17 14:30:26 +09:00
import i18n from 'i18next';
import Backend from 'i18next-chained-backend';
import LocalStorageBackend from 'i18next-localstorage-backend';
import XHR from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
2020-07-29 13:44:03 +09:00
import { initReactI18next } from 'react-i18next';
2019-08-03 13:36:29 +09:00
2020-07-29 13:44:03 +09:00
const TRANSLATION_VERSION = '1.18';
2020-03-06 23:46:19 +09:00
2019-08-03 13:36:29 +09:00
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
2019-08-08 21:34:06 +09:00
backend: {
backends: [LocalStorageBackend, XHR],
2019-08-14 15:13:57 +09:00
backendOptions: [
{
2020-07-29 13:44:03 +09:00
versions: { en: TRANSLATION_VERSION, ja: TRANSLATION_VERSION },
2019-08-14 15:13:57 +09:00
},
],
2019-08-08 21:34:06 +09:00
},
2019-08-03 13:36:29 +09:00
fallbackLng: 'en',
debug: false,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
2019-09-17 14:30:26 +09:00
});
2019-08-03 13:36:29 +09:00
2019-09-17 14:30:26 +09:00
export default i18n;