]> Untitled Git - lemmy-ui.git/blob - src/shared/i18next.ts
Merge branch 'feature/i18n-type-constraint' of https://github.com/shilangyu/lemmy...
[lemmy-ui.git] / src / shared / i18next.ts
1 import i18next, { i18nTyped } from "i18next";
2 import { getLanguage } from "./utils";
3 import { en } from "./translations/en";
4 import { el } from "./translations/el";
5 import { eu } from "./translations/eu";
6 import { eo } from "./translations/eo";
7 import { es } from "./translations/es";
8 import { de } from "./translations/de";
9 import { fr } from "./translations/fr";
10 import { sv } from "./translations/sv";
11 import { ru } from "./translations/ru";
12 import { zh } from "./translations/zh";
13 import { nl } from "./translations/nl";
14 import { it } from "./translations/it";
15 import { fi } from "./translations/fi";
16 import { ca } from "./translations/ca";
17 import { fa } from "./translations/fa";
18 import { hi } from "./translations/hi";
19 import { pl } from "./translations/pl";
20 import { pt_BR } from "./translations/pt_BR";
21 import { ja } from "./translations/ja";
22 import { ka } from "./translations/ka";
23 import { gl } from "./translations/gl";
24 import { tr } from "./translations/tr";
25 import { hu } from "./translations/hu";
26 import { uk } from "./translations/uk";
27 import { sq } from "./translations/sq";
28 import { km } from "./translations/km";
29 import { ga } from "./translations/ga";
30 import { sr_Latn } from "./translations/sr_Latn";
31 import { da } from "./translations/da";
32 import { oc } from "./translations/oc";
33 import { hr } from "./translations/hr";
34 import { th } from "./translations/th";
35
36 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
37 const resources = {
38   en,
39   el,
40   eu,
41   eo,
42   es,
43   ka,
44   hi,
45   de,
46   zh,
47   fr,
48   sv,
49   ru,
50   nl,
51   it,
52   fi,
53   ca,
54   fa,
55   pl,
56   pt_BR,
57   ja,
58   gl,
59   tr,
60   hu,
61   uk,
62   sq,
63   km,
64   ga,
65   sr_Latn,
66   da,
67   oc,
68   hr,
69   th,
70 };
71
72 function format(value: any, format: any): any {
73   return format === "uppercase" ? value.toUpperCase() : value;
74 }
75
76 i18next.init({
77   debug: false,
78   // load: 'languageOnly',
79
80   // initImmediate: false,
81   lng: getLanguage(),
82   fallbackLng: "en",
83   resources,
84   interpolation: { format },
85 });
86
87 export const i18n = i18next as i18nTyped;
88
89 export { resources };