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