]> Untitled Git - lemmy.git/blob - ui/src/i18next.ts
Merge branch 'master' into federation
[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 { pt_BR } from './translations/pt_BR';
17 import { ja } from './translations/ja';
18
19 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
20 const resources = {
21   en,
22   eo,
23   es,
24   de,
25   zh,
26   fr,
27   sv,
28   ru,
29   nl,
30   it,
31   fi,
32   ca,
33   fa,
34   pt_BR,
35   ja,
36 };
37
38 function format(value: any, format: any, lng: any): any {
39   return format === 'uppercase' ? value.toUpperCase() : value;
40 }
41
42 i18next.init({
43   debug: false,
44   // load: 'languageOnly',
45
46   // initImmediate: false,
47   lng: getLanguage(),
48   fallbackLng: 'en',
49   resources,
50   interpolation: { format },
51 });
52
53 export { i18next as i18n, resources };