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