-
Notifications
You must be signed in to change notification settings - Fork 1
/
i18n.js
50 lines (38 loc) · 1.14 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
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import { en } from './assets/langs/en';
import { ar } from './assets/langs/ar';
import { de } from './assets/langs/de';
import { es } from './assets/langs/es';
import { fr } from './assets/langs/fr';
import { ie } from './assets/langs/ie';
import { nl } from './assets/langs/nl';
import { pt } from './assets/langs/pt';
const resources = {
en: { translation: en },
ar: { translation: ar },
de: { translation: de },
es: { translation: es },
fr: { translation: fr },
ie: { translation: ie },
nl: { translation: nl },
pt: { translation: pt }
};
// Set default language
import * as RNLocalize from 'react-native-localize';
const defaultLang = RNLocalize.getLocales()[0].languageCode;
const langs = ['en', 'ar', 'de', 'es', 'fr', 'ie', 'nl', 'pt'];
const lng = langs.includes(defaultLang) ? defaultLang : 'en';
i18n.use(initReactI18next).init({
compatibilityJSON: 'v3',
resources,
lng,
fallbackLng: "en",
interpolation: {
escapeValue: false
},
react: {
useSuspense: false
}
});
export default i18n;