2019-04-15 20:06:39 -04:00
|
|
|
import i18next from 'i18next'
|
2019-05-30 16:42:25 -04:00
|
|
|
import { initReactI18next } from 'react-i18next'
|
2019-04-15 20:06:39 -04:00
|
|
|
import XHR from 'i18next-xhr-backend'
|
2019-04-15 12:56:40 -04:00
|
|
|
import LanguageDetector from 'i18next-browser-languagedetector'
|
2018-12-29 13:36:49 +08:00
|
|
|
|
2019-04-15 20:06:39 -04:00
|
|
|
i18next
|
|
|
|
.use(XHR)
|
2018-12-29 13:36:49 +08:00
|
|
|
.use(LanguageDetector)
|
2019-04-15 20:06:39 -04:00
|
|
|
.use(initReactI18next)
|
2018-12-29 13:36:49 +08:00
|
|
|
.init({
|
2019-04-15 20:06:39 -04:00
|
|
|
backend: {
|
2020-06-30 13:41:51 -04:00
|
|
|
loadPath: `./locales/{{lng}}.json`
|
2019-04-15 20:06:39 -04:00
|
|
|
},
|
2019-04-25 12:12:47 -04:00
|
|
|
react: {
|
2019-05-30 16:42:25 -04:00
|
|
|
useSuspense: true
|
2019-04-25 12:12:47 -04:00
|
|
|
},
|
2019-04-15 12:56:40 -04:00
|
|
|
fallbackLng: 'en',
|
2019-05-30 16:42:25 -04:00
|
|
|
preload: ['en'],
|
2018-12-29 13:36:49 +08:00
|
|
|
keySeparator: false,
|
2019-04-25 12:12:47 -04:00
|
|
|
interpolation: { escapeValue: false }
|
2019-04-15 12:56:40 -04:00
|
|
|
})
|
2018-12-29 13:36:49 +08:00
|
|
|
|
2019-04-15 20:06:39 -04:00
|
|
|
export default i18next
|