mon-entreprise/source/i18n.js

28 lines
555 B
JavaScript
Raw Normal View History

import { I18nextProvider } from 'react-i18next';
import i18next from 'i18next'
import queryString from 'query-string'
import { getIframeOption } from './utils'
import enTranslations from './locales/en.yaml'
2018-04-05 16:01:03 +00:00
let lang = getIframeOption('lang') ||
queryString.parse(location.search)['lang'] ||
sessionStorage['lang'] ||
'fr'
sessionStorage['lang'] = lang
i18next
.init({
debug: true,
lng: lang,
resources: {
en: {
translation: enTranslations
}}
}, (err, t) => {
console.log("Error from i18n load",err,t)
})
export default lang