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