2019-03-21 15:23:57 +01:00
|
|
|
import * as path from 'path'
|
2019-04-03 15:15:46 +02:00
|
|
|
import i18next, { InitOptions } from 'i18next'
|
2019-03-25 13:51:24 +01:00
|
|
|
import Backend from 'i18next-sync-fs-backend'
|
2018-08-10 01:47:29 +02:00
|
|
|
|
2019-03-21 15:23:57 +01:00
|
|
|
const options: InitOptions = {
|
2018-08-10 01:47:29 +02:00
|
|
|
initImmediate: false,
|
2018-08-13 11:05:30 +02:00
|
|
|
lng: 'en',
|
2019-11-18 14:32:43 +01:00
|
|
|
fallbackLng: 'en',
|
|
|
|
saveMissing: true,
|
2018-08-10 01:47:29 +02:00
|
|
|
backend: {
|
|
|
|
// path where resources get loaded from
|
|
|
|
loadPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.json'),
|
|
|
|
|
|
|
|
// path to post missing resources
|
2019-11-18 14:32:43 +01:00
|
|
|
addPath: path.resolve(__dirname, './locales/en/{{ns}}.json'),
|
2018-08-10 01:47:29 +02:00
|
|
|
|
|
|
|
// jsonIndent to use when storing json files
|
|
|
|
jsonIndent: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 14:32:43 +01:00
|
|
|
i18next.use(Backend).init(options)
|
2018-08-10 01:47:29 +02:00
|
|
|
|
|
|
|
export default i18next
|