]> Untitled Git - lemmy-ui.git/blob - src/shared/i18next.ts
Partly functioning fuse-box, but moving te webpack now.
[lemmy-ui.git] / src / shared / i18next.ts
1 import i18next 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
32 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
33 const resources = {
34   en,
35   el,
36   eu,
37   eo,
38   es,
39   ka,
40   hi,
41   de,
42   zh,
43   fr,
44   sv,
45   ru,
46   nl,
47   it,
48   fi,
49   ca,
50   fa,
51   pl,
52   pt_BR,
53   ja,
54   gl,
55   tr,
56   hu,
57   uk,
58   sq,
59   km,
60   ga,
61   sr_Latn,
62 };
63
64 function format(value: any, format: any, lng: any): any {
65   return format === 'uppercase' ? value.toUpperCase() : value;
66 }
67
68 i18next.init({
69   debug: false,
70   // load: 'languageOnly',
71
72   // initImmediate: false,
73   lng: getLanguage(),
74   fallbackLng: 'en',
75   resources,
76   interpolation: { format },
77 });
78
79 export { i18next as i18n, resources };