@@ -9,6 +9,32 @@ import translationFR from './translations/fr-FR.json';
99import translationCN from './translations/zh-CN.json' ;
1010import translationJP from './translations/ja-JP.json' ;
1111
12+ const languages = {
13+ 'en-US' : {
14+ translation : translationEN ,
15+ } ,
16+ 'pt-BR' : {
17+ translation : translationPT ,
18+ } ,
19+ 'es-ES' : {
20+ translation : translationES ,
21+ } ,
22+ 'de-DE' : {
23+ translation : translationDE ,
24+ } ,
25+ 'fr-FR' : {
26+ translation : translationFR ,
27+ } ,
28+ 'zh-CN' : {
29+ translation : translationCN ,
30+ } ,
31+ 'ja-JP' : {
32+ translation : translationJP ,
33+ } ,
34+ } ;
35+
36+ type Language = keyof typeof languages ;
37+
1238i18n
1339 // pass the i18n instance to react-i18next.
1440 . use ( initReactI18next )
2046 fallbackLng : 'en-US' ,
2147 whitelist : [ 'en-US' , 'pt-BR' , 'es-ES' , 'de-DE' , 'fr-FR' , 'zh-CN' , 'ja-JP' ] ,
2248 load : 'currentOnly' ,
23- resources : {
24- 'en-US' : {
25- translation : translationEN ,
26- } ,
27- 'pt-BR' : {
28- translation : translationPT ,
29- } ,
30- 'es-ES' : {
31- translation : translationES ,
32- } ,
33- 'de-DE' : {
34- translation : translationDE ,
35- } ,
36- 'fr-FR' : {
37- translation : translationFR ,
38- } ,
39- 'zh-CN' : {
40- translation : translationCN ,
41- } ,
42- 'ja-JP' : {
43- translation : translationJP ,
44- } ,
45- } ,
49+ resources : languages ,
4650 debug : false ,
4751 interpolation : {
4852 escapeValue : false , // react already safes from xss
4953 } ,
5054 } ) ;
5155
5256export default i18n ;
57+ export { Language } ;
0 commit comments