2018-03-29 12:47:52 +00:00
|
|
|
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
|
2018-03-29 12:47:52 +00:00
|
|
|
|
|
|
|
i18next
|
|
|
|
.init({
|
|
|
|
debug: true,
|
|
|
|
lng: lang,
|
|
|
|
resources: {
|
|
|
|
en: {
|
|
|
|
translation: enTranslations
|
|
|
|
}}
|
|
|
|
}, (err, t) => {
|
|
|
|
console.log("Error from i18n load",err,t)
|
|
|
|
})
|
|
|
|
|
|
|
|
export default lang
|