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