]> Untitled Git - lemmy.git/blob - ui/src/i18next.ts
Adding Esperanto.
[lemmy.git] / ui / src / i18next.ts
1 import * as i18n 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 { zh } from './translations/zh';
8 import { fr } from './translations/fr';
9 import { sv } from './translations/sv';
10 import { ru } from './translations/ru';
11
12 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
13 // TODO don't forget to add moment locales for new languages.
14 const resources = {
15   en,
16   eo,
17   es,
18   de,
19   zh,
20   fr,
21   sv,
22   ru,
23 }
24
25 function format(value: any, format: any, lng: any) {
26         if (format === 'uppercase') return value.toUpperCase();
27         return value;
28 }
29
30 i18n
31 .init({
32   debug: true,
33   // load: 'languageOnly',
34
35   // initImmediate: false,
36   lng: getLanguage(),
37   fallbackLng: 'en',
38         resources,
39         interpolation: {
40     format: format
41     
42   }
43 });
44
45 export { i18n, resources };