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