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