summaryrefslogtreecommitdiffstats
path: root/ui/src/i18next.ts
blob: 36dc6f1d7837ee7810889338c78c1f7cc507ca56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import i18next from 'i18next';
import { getLanguage } from './utils';
import XHR from 'i18next-xhr-backend';

function format(value: any, format: any, lng: any): any {
  return format === 'uppercase' ? value.toUpperCase() : value;
}

i18next
  .use(XHR)
  .init({
    debug: true,
    //load: 'languageOnly',

    // initImmediate: false,
    lng: getLanguage(),
    fallbackLng: 'en',
    interpolation: { format },
    backend: {
      loadPath: '/static/assets/translations/{{lng}}.json',
    }
});

export { i18next as i18n, resources };