-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathi18n.js
143 lines (138 loc) · 4.15 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import * as Localization from 'expo-localization';
import i18next from 'i18next';
import { initReactI18next } from 'react-i18next';
import { I18nManager } from 'react-native';
import ar from './langs/ar.json';
import be from './langs/be.json';
import bg from './langs/bg.json';
import ca from './langs/ca.json';
import cs from './langs/cs.json';
import cy from './langs/cy.json';
import da from './langs/da.json';
import de from './langs/de.json';
import el from './langs/el.json';
import en from './langs/en.json';
import eo from './langs/eo.json';
import es from './langs/es.json';
import es_419 from './langs/es_419.json';
import es_AR from './langs/es_AR.json';
import et from './langs/et.json';
import fa from './langs/fa.json';
import fi from './langs/fi.json';
import fil from './langs/fil.json';
import fr from './langs/fr.json';
import ga from './langs/ga.json';
import he from './langs/he.json';
import hr from './langs/hr.json';
import hu from './langs/hu.json';
import hy from './langs/hy.json';
import id from './langs/id.json';
import is from './langs/is.json';
import it from './langs/it.json';
import ja from './langs/ja.json';
import kk from './langs/kk.json';
import ko from './langs/ko.json';
import lt from './langs/lt.json';
import lv from './langs/lv.json';
import mn from './langs/mn.json';
import ms from './langs/ms.json';
import mt from './langs/mt.json';
import nb_NO from './langs/nb_NO.json';
import nds from './langs/nds.json';
import nl from './langs/nl.json';
import pl from './langs/pl.json';
import pt from './langs/pt.json';
import pt_BR from './langs/pt_BR.json';
import pt_PT from './langs/pt_PT.json';
import ro from './langs/ro.json';
import ru from './langs/ru.json';
import sk from './langs/sk.json';
import sl from './langs/sl.json';
import sq from './langs/sq.json';
import sr from './langs/sr.json';
import sv from './langs/sv.json';
import ta from './langs/ta.json';
import tr from './langs/tr.json';
import uk from './langs/uk.json';
import vi from './langs/vi.json';
import zh_Hans from './langs/zh_Hans.json';
import zh_Hant from './langs/zh_Hant.json';
export const resources = {
en: { translation: en },
ar: { translation: ar },
be: { translation: be },
bg: { translation: bg },
ca: { translation: ca },
cs: { translation: cs },
cy: { translation: cy },
da: { translation: da },
de: { translation: de },
el: { translation: el },
eo: { translation: eo },
es: { translation: es },
'es-419': { translation: es_419 },
'es-AR': { translation: es_AR },
et: { translation: et },
fa: { translation: fa },
fi: { translation: fi },
fil: { translation: fil },
fr: { translation: fr },
ga: { translation: ga },
he: { translation: he },
hr: { translation: hr },
hu: { translation: hu },
hy: { translation: hy },
id: { translation: id },
is: { translation: is },
it: { translation: it },
ja: { translation: ja },
kk: { translation: kk },
ko: { translation: ko },
lt: { translation: lt },
lv: { translation: lv },
mn: { translation: mn },
ms: { translation: ms },
mt: { translation: mt },
'nb-NO': { translation: nb_NO },
nds: { translation: nds },
nl: { translation: nl },
pl: { translation: pl },
pt: { translation: pt },
'pt-BR': { translation: pt_BR },
'pt-PT': { translation: pt_PT },
ro: { translation: ro },
ru: { translation: ru },
sk: { translation: sk },
sl: { translation: sl },
sq: { translation: sq },
sr: { translation: sr },
sv: { translation: sv },
ta: { translation: ta },
tr: { translation: tr },
uk: { translation: uk },
vi: { translation: vi },
'zh-Hans': { translation: zh_Hans },
'zh-Hant': { translation: zh_Hant }
};
// Ensure RTL layout is enabled for RTL locales
I18nManager.forceRTL(Localization.isRTL);
i18next
.use(initReactI18next)
.init({
// debug: true,
fallbackLng: 'en',
// Use the fallback language for empty strings
returnEmptyString: false,
lng: Localization.locale,
interpolation: {
escapeValue: false
},
resources
});
// Export i18next instance for use in tests
export default i18next;