]> Untitled Git - lemmy.git/blob - ui/src/i18next.ts
36dc6f1d7837ee7810889338c78c1f7cc507ca56
[lemmy.git] / ui / src / i18next.ts
1 import i18next from 'i18next';
2 import { getLanguage } from './utils';
3 import XHR from 'i18next-xhr-backend';
4
5 function format(value: any, format: any, lng: any): any {
6   return format === 'uppercase' ? value.toUpperCase() : value;
7 }
8
9 i18next
10   .use(XHR)
11   .init({
12     debug: true,
13     //load: 'languageOnly',
14
15     // initImmediate: false,
16     lng: getLanguage(),
17     fallbackLng: 'en',
18     interpolation: { format },
19     backend: {
20       loadPath: '/static/assets/translations/{{lng}}.json',
21     }
22 });
23
24 export { i18next as i18n, resources };