2019-03-21 15:23:57 +01:00
|
|
|
import * as path from 'path'
|
2019-03-25 13:51:24 +01:00
|
|
|
import i18next from 'i18next'
|
|
|
|
import Backend from 'i18next-sync-fs-backend'
|
2019-03-21 15:23:57 +01:00
|
|
|
import { InitOptions } from 'i18next'
|
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',
|
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
|
|
|
|
addPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.missing.json'),
|
|
|
|
|
|
|
|
// jsonIndent to use when storing json files
|
|
|
|
jsonIndent: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i18next
|
|
|
|
.use(Backend)
|
|
|
|
.init(options)
|
|
|
|
|
|
|
|
export default i18next
|