summaryrefslogtreecommitdiffstats
path: root/ui/src/i18next.ts
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-02-28 22:18:47 +0100
committerFelix Ableitner <me@nutomic.com>2020-02-29 19:16:23 +0100
commitd7f49cea9a809f9c24947e7c4c941118c22a1f86 (patch)
tree51d7b892838be93fbca4cf1993c8d711233d1205 /ui/src/i18next.ts
parent51653015a075e23bbc26acec198ede785b857602 (diff)
generate typescript during compilation
Diffstat (limited to 'ui/src/i18next.ts')
-rw-r--r--ui/src/i18next.ts53
1 files changed, 40 insertions, 13 deletions
diff --git a/ui/src/i18next.ts b/ui/src/i18next.ts
index 36dc6f1d..0ee5b1a3 100644
--- a/ui/src/i18next.ts
+++ b/ui/src/i18next.ts
@@ -1,24 +1,51 @@
import i18next from 'i18next';
import { getLanguage } from './utils';
-import XHR from 'i18next-xhr-backend';
+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,
+};
function format(value: any, format: any, lng: any): any {
return format === 'uppercase' ? value.toUpperCase() : value;
}
-i18next
- .use(XHR)
- .init({
- debug: true,
- //load: 'languageOnly',
+i18next.init({
+ debug: false,
+ // load: 'languageOnly',
- // initImmediate: false,
- lng: getLanguage(),
- fallbackLng: 'en',
- interpolation: { format },
- backend: {
- loadPath: '/static/assets/translations/{{lng}}.json',
- }
+ // initImmediate: false,
+ lng: getLanguage(),
+ fallbackLng: 'en',
+ resources,
+ interpolation: { format },
});
export { i18next as i18n, resources };