pull/2163/head
Jérémy Rialland 2022-06-02 16:34:17 +02:00 committed by Johan Girod
parent ed1b999fb8
commit e4e9e6327d
3 changed files with 14 additions and 6 deletions

View File

@ -8,7 +8,9 @@ import i18n from '../../locales/i18n'
export type Rules = Record<DottedName, Rule>
const unitsTranslations = Object.entries(i18n.getResourceBundle('fr', 'units'))
const unitsTranslations = Object.entries(
i18n.getResourceBundle('fr', 'units') as Record<string, string>
)
const engineOptions = {
getUnitKey(unit: string): string {
const key = unitsTranslations

View File

@ -4,17 +4,23 @@ import unitsTranslations from './units.yaml'
export type AvailableLangs = 'fr' | 'en'
interface Units {
fr: Record<string, string>
en: Record<string, string>
}
i18next
.use(initReactI18next)
.init({
resources: {
fr: { units: unitsTranslations.fr },
en: { units: unitsTranslations.en },
fr: { units: (unitsTranslations as Units).fr },
en: { units: (unitsTranslations as Units).en },
},
react: {
useSuspense: false,
},
})
// eslint-disable-next-line no-console
.catch((err) => console?.error('Error from i18n load', err))
export default i18next

View File

@ -191,7 +191,7 @@ function Home() {
const setEntreprise = useSetEntreprise()
const updateEntrprise =
const updateEntreprise =
overwrite &&
!entreprisePending &&
!entrepriseNotFound &&
@ -199,11 +199,11 @@ function Home() {
entreprise.siren !== engineSiren
useEffect(() => {
if (updateEntrprise) {
if (updateEntreprise) {
setEntreprise(entreprise)
setOverwrite(false)
}
}, [entreprise, setEntreprise, updateEntrprise])
}, [entreprise, setEntreprise, updateEntreprise])
if (
gérerPath &&