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