1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-08 22:15:02 +00:00
mon-entreprise/source/i18n.js
Étienne Charignon 5e1dfb98c6 👽 translate the suggestion tooltip
I had to force the default language to a value (I forced it to 'fr') so
that the fr resource is effectively loaded in the first place
2018-04-12 11:33:31 +02:00

30 lines
562 B
JavaScript

import { I18nextProvider } from 'react-i18next'
import i18next from 'i18next'
import queryString from 'query-string'
import { getIframeOption } from './utils'
import enTranslations from './locales/en.yaml'
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