Whalebird-desktop-client-ma.../src/config/i18n.ts

26 lines
599 B
TypeScript
Raw Normal View History

2019-03-21 15:23:57 +01:00
import * as path from 'path'
import i18next from 'i18next'
import Backend from 'i18next-sync-fs-backend'
2019-03-21 15:23:57 +01:00
import { InitOptions } from 'i18next'
2019-03-21 15:23:57 +01:00
const options: InitOptions = {
initImmediate: false,
lng: 'en',
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