summaryrefslogtreecommitdiffstats
path: root/ui/src/i18next.ts
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-02-28 18:48:30 +0100
committerFelix Ableitner <me@nutomic.com>2020-02-29 19:08:19 +0100
commitc0802c7fa27602d183d82621e9412a8bf1931c76 (patch)
treea73d69f7085ddc3d50f98865a5f6b34e625efb1f /ui/src/i18next.ts
parent72c5bdbf9e788243df4b2ec1249495e4d7f4092c (diff)
make i18n compatible with weblate
Diffstat (limited to 'ui/src/i18next.ts')
-rw-r--r--ui/src/i18next.ts53
1 files changed, 13 insertions, 40 deletions
diff --git a/ui/src/i18next.ts b/ui/src/i18next.ts
index 4311b09f..36dc6f1d 100644
--- a/ui/src/i18next.ts
+++ b/ui/src/i18next.ts
@@ -1,51 +1,24 @@
import i18next from 'i18next';
import { getLanguage } from './utils';
-import { en } from './translations/en';
-import { eo } from './translations/eo';
-import { es } from './translations/es';
-import { de } from './translations/de';
-import { fr } from './translations/fr';
-import { sv } from './translations/sv';
-import { ru } from './translations/ru';
-import { zh } from './translations/zh';
-import { nl } from './translations/nl';
-import { it } from './translations/it';
-import { fi } from './translations/fi';
-import { ca } from './translations/ca';
-import { fa } from './translations/fa';
-import { pt_BR } from './translations/pt_br';
-
-// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
-const resources = {
- en,
- eo,
- es,
- de,
- zh,
- fr,
- sv,
- ru,
- nl,
- it,
- fi,
- ca,
- fa,
- pt_BR,
-};
+import XHR from 'i18next-xhr-backend';
function format(value: any, format: any, lng: any): any {
return format === 'uppercase' ? value.toUpperCase() : value;
}
-i18next.init({
- debug: false,
- // load: 'languageOnly',
+i18next
+ .use(XHR)
+ .init({
+ debug: true,
+ //load: 'languageOnly',
- // initImmediate: false,
- lng: getLanguage(),
- fallbackLng: 'en',
- resources,
- interpolation: { format },
+ // initImmediate: false,
+ lng: getLanguage(),
+ fallbackLng: 'en',
+ interpolation: { format },
+ backend: {
+ loadPath: '/static/assets/translations/{{lng}}.json',
+ }
});
export { i18next as i18n, resources };