]> Untitled Git - lemmy-ui.git/blob - src/shared/i18next.ts
Merge pull request #323 from LemmyNet/fix/page-refresh
[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 import { bg } from "./translations/bg";
36 import { ar } from "./translations/ar";
37 import { ko } from "./translations/ko";
38 import { id } from "./translations/id";
39 import { nb_NO } from "./translations/nb_NO";
40 import { zh_Hant } from "./translations/zh_Hant";
41
42 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
43 const resources = {
44   en,
45   el,
46   eu,
47   eo,
48   es,
49   ka,
50   hi,
51   de,
52   zh,
53   fr,
54   sv,
55   ru,
56   nl,
57   it,
58   fi,
59   ca,
60   fa,
61   pl,
62   pt_BR,
63   ja,
64   gl,
65   tr,
66   hu,
67   uk,
68   sq,
69   km,
70   ga,
71   sr_Latn,
72   da,
73   oc,
74   hr,
75   th,
76   bg,
77   ar,
78   ko,
79   id,
80   nb_NO,
81   zh_Hant,
82 };
83
84 function format(value: any, format: any): any {
85   return format === "uppercase" ? value.toUpperCase() : value;
86 }
87
88 i18next.init({
89   debug: false,
90   // load: 'languageOnly',
91
92   // initImmediate: false,
93   lng: getLanguage(),
94   fallbackLng: "en",
95   resources,
96   interpolation: { format },
97 });
98
99 export const i18n = i18next as i18nTyped;
100
101 export { resources };