-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi18n.config.js
31 lines (27 loc) · 987 Bytes
/
i18n.config.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
import {I18nManager} from 'react-native';
import i18n from 'i18next';
import {initReactI18next} from 'react-i18next';
const en = require('./app/config/locales/en.json');
const ar = require('./app/config/locales/ar.json');
i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
compatibilityJSON: 'v3',
// the translations
// (tip move them in a JSON file and import them,
// or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
resources: {
en: {
common: en,
},
ar: {
common: ar,
},
},
lng: I18nManager.isRTL ? 'ar' : 'en', // if you're using a language detector, do not define the lng option
fallbackLng: 'en',
interpolation: {
escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
},
});
export default i18n;