]> Untitled Git - lemmy-ui.git/blob - src/shared/i18next.ts
Fixing nav-link
[lemmy-ui.git] / src / shared / i18next.ts
1 import i18next, { i18nTyped } from "i18next";
2 import { ar } from "./translations/ar";
3 import { bg } from "./translations/bg";
4 import { bn } from "./translations/bn";
5 import { ca } from "./translations/ca";
6 import { cs } from "./translations/cs";
7 import { cy } from "./translations/cy";
8 import { da } from "./translations/da";
9 import { de } from "./translations/de";
10 import { el } from "./translations/el";
11 import { en } from "./translations/en";
12 import { eo } from "./translations/eo";
13 import { es } from "./translations/es";
14 import { eu } from "./translations/eu";
15 import { fa } from "./translations/fa";
16 import { fi } from "./translations/fi";
17 import { fr } from "./translations/fr";
18 import { ga } from "./translations/ga";
19 import { gl } from "./translations/gl";
20 import { hi } from "./translations/hi";
21 import { hr } from "./translations/hr";
22 import { hu } from "./translations/hu";
23 import { id } from "./translations/id";
24 import { it } from "./translations/it";
25 import { ja } from "./translations/ja";
26 import { ka } from "./translations/ka";
27 import { km } from "./translations/km";
28 import { ko } from "./translations/ko";
29 import { ml } from "./translations/ml";
30 import { mnc } from "./translations/mnc";
31 import { nb_NO } from "./translations/nb_NO";
32 import { nl } from "./translations/nl";
33 import { oc } from "./translations/oc";
34 import { pl } from "./translations/pl";
35 import { pt } from "./translations/pt";
36 import { pt_BR } from "./translations/pt_BR";
37 import { ru } from "./translations/ru";
38 import { sk } from "./translations/sk";
39 import { sq } from "./translations/sq";
40 import { sr_Latn } from "./translations/sr_Latn";
41 import { sv } from "./translations/sv";
42 import { th } from "./translations/th";
43 import { tr } from "./translations/tr";
44 import { uk } from "./translations/uk";
45 import { vi } from "./translations/vi";
46 import { zh } from "./translations/zh";
47 import { zh_Hant } from "./translations/zh_Hant";
48 import { getLanguage } from "./utils";
49
50 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
51 const resources = {
52   en,
53   el,
54   eu,
55   eo,
56   es,
57   ka,
58   hi,
59   de,
60   zh,
61   fr,
62   sv,
63   ru,
64   nl,
65   it,
66   fi,
67   ca,
68   fa,
69   pl,
70   pt_BR,
71   ja,
72   gl,
73   tr,
74   hu,
75   uk,
76   sq,
77   km,
78   ga,
79   sr_Latn,
80   da,
81   oc,
82   hr,
83   th,
84   bg,
85   ar,
86   ko,
87   id,
88   nb_NO,
89   zh_Hant,
90   cy,
91   mnc,
92   sk,
93   vi,
94   pt,
95   bn,
96   ml,
97   cs,
98 };
99
100 function format(value: any, format: any): any {
101   return format === "uppercase" ? value.toUpperCase() : value;
102 }
103
104 i18next.init({
105   debug: false,
106   compatibilityJSON: "v3",
107   // load: 'languageOnly',
108
109   // initImmediate: false,
110   lng: getLanguage(),
111   fallbackLng: "en",
112   resources,
113   interpolation: { format },
114 });
115
116 export const i18n = i18next as i18nTyped;
117
118 export { resources };