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