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