]> Untitled Git - lemmy.git/blob - ui/src/i18next.ts
Merge branch 'master' of https://github.com/lemmynet/lemmy
[lemmy.git] / ui / src / i18next.ts
1 import i18next from 'i18next';
2 import { getLanguage } from './utils';
3 import { en } from './translations/en';
4 import { eo } from './translations/eo';
5 import { es } from './translations/es';
6 import { de } from './translations/de';
7 import { fr } from './translations/fr';
8 import { sv } from './translations/sv';
9 import { ru } from './translations/ru';
10 import { zh } from './translations/zh';
11 import { nl } from './translations/nl';
12 import { it } from './translations/it';
13 import { fi } from './translations/fi';
14 import { ca } from './translations/ca';
15 import { fa } from './translations/fa';
16 import { hi } from './translations/hi';
17 import { pt_BR } from './translations/pt_BR';
18 import { ja } from './translations/ja';
19 import { ka } from './translations/ka';
20
21 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
22 const resources = {
23   en,
24   eo,
25   es,
26   ka,
27   hi,
28   de,
29   zh,
30   fr,
31   sv,
32   ru,
33   nl,
34   it,
35   fi,
36   ca,
37   fa,
38   pt_BR,
39   ja,
40 };
41
42 function format(value: any, format: any, lng: any): any {
43   return format === 'uppercase' ? value.toUpperCase() : value;
44 }
45
46 i18next.init({
47   debug: false,
48   // load: 'languageOnly',
49
50   // initImmediate: false,
51   lng: getLanguage(),
52   fallbackLng: 'en',
53   resources,
54   interpolation: { format },
55 });
56
57 export { i18next as i18n, resources };