]> Untitled Git - lemmy.git/blob - ui/src/i18next.ts
Adding Polish language (#784)
[lemmy.git] / ui / src / 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
24 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
25 const resources = {
26   en,
27   el,
28   eu,
29   eo,
30   es,
31   ka,
32   hi,
33   de,
34   zh,
35   fr,
36   sv,
37   ru,
38   nl,
39   it,
40   fi,
41   ca,
42   fa,
43   pl,
44   pt_BR,
45   ja,
46 };
47
48 function format(value: any, format: any, lng: any): any {
49   return format === 'uppercase' ? value.toUpperCase() : value;
50 }
51
52 i18next.init({
53   debug: false,
54   // load: 'languageOnly',
55
56   // initImmediate: false,
57   lng: getLanguage(),
58   fallbackLng: 'en',
59   resources,
60   interpolation: { format },
61 });
62
63 export { i18next as i18n, resources };