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