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