|
171
|
1 |
import i18n from "i18next"; |
|
|
2 |
import { reactI18nextModule } from "react-i18next"; |
|
|
3 |
import detector from "i18next-browser-languagedetector"; |
|
|
4 |
|
|
|
5 |
import translationFR from "./locales/fr/translation.json"; |
|
|
6 |
import translationEN from "./locales/en/translation.json"; |
|
|
7 |
|
|
|
8 |
// the translations |
|
|
9 |
const resources = { |
|
|
10 |
fr: { |
|
|
11 |
translation: translationFR |
|
|
12 |
}, |
|
|
13 |
en: { |
|
|
14 |
translation: translationEN |
|
|
15 |
} |
|
|
16 |
}; |
|
|
17 |
|
|
|
18 |
i18n |
|
|
19 |
.use(detector) |
|
|
20 |
.use(reactI18nextModule) // passes i18n down to react-i18next |
|
|
21 |
.init({ |
|
|
22 |
resources, |
|
|
23 |
debug: true, |
|
|
24 |
fallbackLng: "fr", |
|
|
25 |
|
|
|
26 |
interpolation: { |
|
|
27 |
escapeValue: false // react already safes from xss |
|
|
28 |
} |
|
|
29 |
}); |
|
|
30 |
|
|
|
31 |
export default i18n; |