tooot/src/i18n/i18n.ts

31 lines
553 B
TypeScript
Raw Normal View History

2021-01-27 00:35:34 +01:00
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
2020-12-13 14:04:25 +01:00
import en from '@root/i18n/en/_all'
2021-01-17 22:37:05 +01:00
import zh_Hans from '@root/i18n/zh-Hans/_all'
2020-11-29 18:08:31 +01:00
2021-01-27 00:35:34 +01:00
i18n.use(initReactI18next).init({
lng: 'en',
2021-01-17 22:37:05 +01:00
fallbackLng: 'en',
ns: ['common'],
defaultNS: 'common',
2021-01-17 22:37:05 +01:00
resources: { 'zh-Hans': zh_Hans, en },
saveMissing: true,
2021-01-20 00:39:39 +01:00
missingKeyHandler: (ns, key) => {
console.log('i18n missing: ' + ns + ' : ' + key)
},
interpolation: {
escapeValue: false
2021-01-27 00:35:34 +01:00
},
react: {
useSuspense: false
},
debug: true
})
2021-01-27 00:35:34 +01:00
export default i18n