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