forked from ProjectMirador/mirador
-
Notifications
You must be signed in to change notification settings - Fork 0
/
i18n.js
58 lines (54 loc) · 1.45 KB
/
i18n.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import ar from './locales/ar/translation.json';
import de from './locales/de/translation.json';
import en from './locales/en/translation.json';
import zhCn from './locales/zhCn/translation.json';
import zhTw from './locales/zhTw/translation.json';
import fr from './locales/fr/translation.json';
import ja from './locales/ja/translation.json';
import kr from './locales/kr/translation.json';
import nl from './locales/nl/translation.json';
import pl from './locales/pl/translation.json';
import ptBr from './locales/ptBr/translation.json';
import it from './locales/it/translation.json';
import sr from './locales/sr/translation.json';
import sv from './locales/sv/translation.json';
import lt from './locales/lt/translation.json';
import vi from './locales/vi/translation.json';
import nbNo from './locales/nbNo/translation.json';
/**
* Load translations for each language
*/
function createI18nInstance() {
const resources = {
ar,
de,
en,
fr,
it,
ja,
kr,
lt,
'nb-NO': nbNo,
nl,
pl,
'pt-BR': ptBr,
sr,
sv,
vi,
'zh-CN': zhCn,
'zh-TW': zhTw,
};
const instance = i18n.createInstance();
instance.use(initReactI18next).init({
fallbackLng: 'en',
interpolation: {
escapeValue: false, // react is already safe from xss
},
lng: 'en',
resources,
});
return instance;
}
export default createI18nInstance;