1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-01 22:10:04 +09:00
namae/src/util/i18n.ts
2020-07-30 23:14:02 +09:00

35 lines
857 B
TypeScript

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';
import { initReactI18next } from 'react-i18next';
const TRANSLATION_VERSION = '1.19';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
backend: {
backends: [LocalStorageBackend, XHR],
backendOptions: [
{
versions: {
en: TRANSLATION_VERSION,
ja: TRANSLATION_VERSION,
'zh-Hans': TRANSLATION_VERSION,
},
},
],
},
fallbackLng: 'en',
debug: false,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
});
export default i18n;