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

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-08-31 08:41:53 +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';
import { initReactI18next } from 'react-i18next';
2019-08-03 13:36:29 +09:00
2022-06-04 17:00:40 +09:00
const TRANSLATION_VERSION = '17';
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-30 23:14:02 +09:00
versions: {
en: TRANSLATION_VERSION,
2020-08-01 00:08:34 +09:00
de: TRANSLATION_VERSION,
fr: TRANSLATION_VERSION,
2020-07-30 23:14:02 +09:00
ja: TRANSLATION_VERSION,
'zh-Hans': TRANSLATION_VERSION,
2020-07-31 11:32:54 +09:00
'zh-Hant': TRANSLATION_VERSION,
2022-01-31 12:07:25 -03:00
'pt-BR': TRANSLATION_VERSION,
2022-03-28 16:28:47 +09:00
es: TRANSLATION_VERSION,
2022-04-11 18:40:52 +02:00
it: TRANSLATION_VERSION,
ru: TRANSLATION_VERSION,
2022-05-25 22:14:32 +02:00
nl: TRANSLATION_VERSION,
id: TRANSLATION_VERSION,
2020-07-30 23:14:02 +09:00
},
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
},
2020-08-31 08:41:53 +09:00
});
2019-08-03 13:36:29 +09:00
2020-08-31 08:41:53 +09:00
export default i18n;