-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathi18n.ts
More file actions
36 lines (34 loc) · 822 Bytes
/
i18n.ts
File metadata and controls
36 lines (34 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import HttpApi from 'i18next-http-backend';
i18n
.use(initReactI18next)
.use(LanguageDetector)
.use(HttpApi)
.init({
supportedLngs: ['en', 'nl'],
lng: 'en',
fallbackLng: 'en',
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
detection: {
order: [
'querystring',
'cookie',
'localStorage',
'sessionStorage',
'navigator',
'htmlTag',
'path',
'subdomain',
],
caches: ['cookie'],
},
backend: {
loadPath: '/locales/{{lng}}/translation.json',
},
react: { useSuspense: true },
});
export default i18n;