@configuratorware/configurator-frontendgui 1.49.5 → 1.49.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/Store.js +0 -3
- package/App/Translations.js +93 -7
- package/App/configuration.js +0 -49
- package/App/index.js +50 -9
- package/package.json +4 -4
- package/src/App/Store.js +0 -3
- package/src/App/Translations.js +32 -3
- package/src/App/configuration.js +0 -45
- package/src/App/index.js +8 -2
package/App/Store.js
CHANGED
|
@@ -15,7 +15,6 @@ var _configuration = require("./configuration");
|
|
|
15
15
|
var _Reducers = _interopRequireDefault(require("./Reducers"));
|
|
16
16
|
var _Reducer = _interopRequireDefault(require("./Reducers/Device/Reducer"));
|
|
17
17
|
var _Reducer2 = _interopRequireDefault(require("./Reducers/Reducer"));
|
|
18
|
-
var _i18n = require("../Framework/i18n");
|
|
19
18
|
var _GeneralActions = require("./Reducers/GeneralActions");
|
|
20
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
20
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -61,6 +60,4 @@ store.dispatch((0, _GeneralActions.setInitialState)());
|
|
|
61
60
|
|
|
62
61
|
// translation setup
|
|
63
62
|
(0, _reactReduxI18n.syncTranslationWithStore)(store);
|
|
64
|
-
// setup
|
|
65
|
-
(0, _i18n.setStore)(store, (0, _configuration.getConf)('language'));
|
|
66
63
|
var _default = exports["default"] = store;
|
package/App/Translations.js
CHANGED
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.findInitialLanguage = findInitialLanguage;
|
|
6
7
|
exports.initLanguage = initLanguage;
|
|
7
|
-
|
|
8
|
+
exports.loadTranslationFile = loadTranslationFile;
|
|
8
9
|
var _configuration = require("./configuration");
|
|
10
|
+
var _Api = _interopRequireDefault(require("../Framework/Api"));
|
|
11
|
+
var _i18n = require("../Framework/i18n");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
13
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
14
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
16
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
-
function
|
|
14
|
-
return
|
|
17
|
+
function loadTranslationFile(_x, _x2) {
|
|
18
|
+
return _loadTranslationFile.apply(this, arguments);
|
|
15
19
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
20
|
+
function _loadTranslationFile() {
|
|
21
|
+
_loadTranslationFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(lang, baseURL) {
|
|
18
22
|
var fileKey, langKey, results;
|
|
19
23
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
24
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -40,13 +44,14 @@ function _initLanguage() {
|
|
|
40
44
|
case 11:
|
|
41
45
|
results = _context.t0;
|
|
42
46
|
results.forEach(_i18n.use);
|
|
43
|
-
|
|
47
|
+
return _context.abrupt("return", results);
|
|
48
|
+
case 14:
|
|
44
49
|
case "end":
|
|
45
50
|
return _context.stop();
|
|
46
51
|
}
|
|
47
52
|
}, _callee);
|
|
48
53
|
}));
|
|
49
|
-
return
|
|
54
|
+
return _loadTranslationFile.apply(this, arguments);
|
|
50
55
|
}
|
|
51
56
|
function loadLanguageJson(filename, langKey) {
|
|
52
57
|
return new Promise(function (resolve) {
|
|
@@ -71,4 +76,85 @@ function loadLanguageJson(filename, langKey) {
|
|
|
71
76
|
});
|
|
72
77
|
request.send();
|
|
73
78
|
});
|
|
79
|
+
}
|
|
80
|
+
function findInitialLanguage() {
|
|
81
|
+
return _findInitialLanguage.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
function _findInitialLanguage() {
|
|
84
|
+
_findInitialLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
85
|
+
var _languages$find;
|
|
86
|
+
var languages, language, _navigator$languages, _ref, browserLanguage, matchToBrowserLanguage;
|
|
87
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
88
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
_context2.next = 2;
|
|
91
|
+
return _Api["default"].request({
|
|
92
|
+
url: 'languages'
|
|
93
|
+
});
|
|
94
|
+
case 2:
|
|
95
|
+
languages = _context2.sent.data;
|
|
96
|
+
language = languages === null || languages === void 0 || (_languages$find = languages.find(function (lang) {
|
|
97
|
+
return lang.isDefault;
|
|
98
|
+
})) === null || _languages$find === void 0 ? void 0 : _languages$find.iso; // priority for api default language
|
|
99
|
+
if (!language && languages !== null && languages !== void 0 && languages.length) {
|
|
100
|
+
browserLanguage = (((_navigator$languages = navigator.languages) === null || _navigator$languages === void 0 ? void 0 : _navigator$languages[0]) || navigator.language).replace('-', '_');
|
|
101
|
+
matchToBrowserLanguage = languages.find(function (lang) {
|
|
102
|
+
return lang.iso === browserLanguage;
|
|
103
|
+
});
|
|
104
|
+
language = (_ref = matchToBrowserLanguage || languages[0]) === null || _ref === void 0 ? void 0 : _ref.iso;
|
|
105
|
+
}
|
|
106
|
+
return _context2.abrupt("return", language || 'de_DE');
|
|
107
|
+
case 6:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context2.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee2);
|
|
112
|
+
}));
|
|
113
|
+
return _findInitialLanguage.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
function initLanguage() {
|
|
116
|
+
return _initLanguage.apply(this, arguments);
|
|
117
|
+
}
|
|
118
|
+
function _initLanguage() {
|
|
119
|
+
_initLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
120
|
+
var options,
|
|
121
|
+
language,
|
|
122
|
+
translations,
|
|
123
|
+
_args3 = arguments;
|
|
124
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
125
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
126
|
+
case 0:
|
|
127
|
+
options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
128
|
+
_context3.t0 = (0, _configuration.getConf)('language');
|
|
129
|
+
if (_context3.t0) {
|
|
130
|
+
_context3.next = 6;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
_context3.next = 5;
|
|
134
|
+
return findInitialLanguage();
|
|
135
|
+
case 5:
|
|
136
|
+
_context3.t0 = _context3.sent;
|
|
137
|
+
case 6:
|
|
138
|
+
language = _context3.t0.replace('_', '-');
|
|
139
|
+
(0, _configuration.setConf)('language', language);
|
|
140
|
+
_Api["default"].setLanguage(language);
|
|
141
|
+
document.documentElement.lang = language.substring(0, 2);
|
|
142
|
+
_context3.next = 12;
|
|
143
|
+
return loadTranslationFile(language, (0, _configuration.getConf)('network.baseURL'));
|
|
144
|
+
case 12:
|
|
145
|
+
translations = _context3.sent;
|
|
146
|
+
if (options !== null && options !== void 0 && options.store) {
|
|
147
|
+
(0, _i18n.setStore)(options.store, language);
|
|
148
|
+
}
|
|
149
|
+
return _context3.abrupt("return", {
|
|
150
|
+
language: language,
|
|
151
|
+
translations: translations
|
|
152
|
+
});
|
|
153
|
+
case 15:
|
|
154
|
+
case "end":
|
|
155
|
+
return _context3.stop();
|
|
156
|
+
}
|
|
157
|
+
}, _callee3);
|
|
158
|
+
}));
|
|
159
|
+
return _initLanguage.apply(this, arguments);
|
|
74
160
|
}
|
package/App/configuration.js
CHANGED
|
@@ -14,12 +14,9 @@ exports.setConf = setConf;
|
|
|
14
14
|
exports.setConfiguration = setConfiguration;
|
|
15
15
|
exports.setCustomApplicationConfiguration = void 0;
|
|
16
16
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
17
|
-
var _find = _interopRequireDefault(require("lodash/find"));
|
|
18
|
-
var _first = _interopRequireDefault(require("lodash/first"));
|
|
19
17
|
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
20
18
|
var _set = _interopRequireDefault(require("lodash/set"));
|
|
21
19
|
var _Api = _interopRequireDefault(require("../Framework/Api"));
|
|
22
|
-
var _Translations = require("./Translations");
|
|
23
20
|
var _hyphenatedDe = _interopRequireDefault(require("hyphenated-de"));
|
|
24
21
|
var _Reducer = require("./Reducers/Configurator/Reducer");
|
|
25
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -258,7 +255,6 @@ function init() {
|
|
|
258
255
|
}
|
|
259
256
|
applicationConfiguration = (0, _merge["default"])(applicationConfiguration, getQueryParams());
|
|
260
257
|
_Api["default"].init(applicationConfiguration.network);
|
|
261
|
-
setLanguage();
|
|
262
258
|
setDocumentDomain();
|
|
263
259
|
preventLeavingPage();
|
|
264
260
|
return applicationConfiguration;
|
|
@@ -340,7 +336,6 @@ function getQueryParams() {
|
|
|
340
336
|
}
|
|
341
337
|
function setConfiguration(customApplicationConfiguration) {
|
|
342
338
|
applicationConfiguration = (0, _merge["default"])(applicationConfiguration, customApplicationConfiguration, getQueryParams());
|
|
343
|
-
setLanguage();
|
|
344
339
|
|
|
345
340
|
// if there is a config for network Api instance defaults must be updated
|
|
346
341
|
if (applicationConfiguration.network) {
|
|
@@ -356,50 +351,6 @@ function setConfiguration(customApplicationConfiguration) {
|
|
|
356
351
|
(0, _Reducer.setStateChangeReducers)(stateChangeReducers);
|
|
357
352
|
}
|
|
358
353
|
}
|
|
359
|
-
function setLanguage() {
|
|
360
|
-
var language;
|
|
361
|
-
// if the default language is defined in the configuration
|
|
362
|
-
if (applicationConfiguration.language) {
|
|
363
|
-
language = applicationConfiguration.language;
|
|
364
|
-
}
|
|
365
|
-
// if there is a locales array in the configuration...
|
|
366
|
-
else if (applicationConfiguration.locales) {
|
|
367
|
-
var browserLanguage = (0, _get["default"])(navigator, 'languages[0]', navigator.language).replace('-', '_');
|
|
368
|
-
var matchToBrowserLanguage = (0, _find["default"])(applicationConfiguration.locales, {
|
|
369
|
-
code: browserLanguage
|
|
370
|
-
});
|
|
371
|
-
var preferred = (0, _find["default"])(applicationConfiguration.locales, {
|
|
372
|
-
preferred: true
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
// if there is a match with the browser language use that
|
|
376
|
-
if (matchToBrowserLanguage) {
|
|
377
|
-
language = matchToBrowserLanguage.code;
|
|
378
|
-
}
|
|
379
|
-
// if the preferred language is set use it
|
|
380
|
-
else if (preferred) {
|
|
381
|
-
language = preferred.code;
|
|
382
|
-
}
|
|
383
|
-
// otherwise use the first from the locales list
|
|
384
|
-
else {
|
|
385
|
-
language = (0, _first["default"])(applicationConfiguration.locales).code;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
// we have no info about the language, so try to use the browser language
|
|
389
|
-
else {
|
|
390
|
-
language = (0, _get["default"])(navigator, 'languages[0]', navigator.language).replace('-', '_') || 'de_DE';
|
|
391
|
-
}
|
|
392
|
-
if (!(0, _find["default"])(applicationConfiguration.locales, {
|
|
393
|
-
code: language
|
|
394
|
-
})) {
|
|
395
|
-
// eslint-disable-next-line no-console
|
|
396
|
-
console.warn("The selected language (".concat(language, ") is not listed in the available languages!"));
|
|
397
|
-
}
|
|
398
|
-
applicationConfiguration.language = language.replace('_', '-');
|
|
399
|
-
_Api["default"].setLanguage(applicationConfiguration.language);
|
|
400
|
-
document.documentElement.lang = language.substring(0, 2);
|
|
401
|
-
(0, _Translations.initLanguage)(applicationConfiguration.language, applicationConfiguration.network.baseURL);
|
|
402
|
-
}
|
|
403
354
|
|
|
404
355
|
// backward compatibility alias
|
|
405
356
|
var setCustomApplicationConfiguration = exports.setCustomApplicationConfiguration = setConfiguration;
|
package/App/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.render = exports.main = exports["default"] = exports.App = void 0;
|
|
7
|
+
exports.render = exports.main = exports.languageInitPromise = exports["default"] = exports.App = void 0;
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _client = require("react-dom/client");
|
|
9
10
|
var _reactRedux = require("react-redux");
|
|
@@ -13,18 +14,58 @@ var _initServices = require("./initServices");
|
|
|
13
14
|
var _Routing = _interopRequireDefault(require("./Routing"));
|
|
14
15
|
var _Store = require("./Store");
|
|
15
16
|
var _ServiceLocator = require("./ServiceLocator");
|
|
17
|
+
var _Translations = require("./Translations");
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
22
|
var App = exports.App = function App() {
|
|
18
23
|
return /*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
|
|
19
24
|
store: _Store.store
|
|
20
25
|
}, /*#__PURE__*/_react["default"].createElement(_Routing["default"], null));
|
|
21
26
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
var languageInitPromise = exports.languageInitPromise = (0, _Translations.initLanguage)({
|
|
28
|
+
store: _Store.store
|
|
29
|
+
});
|
|
30
|
+
var render = exports.render = /*#__PURE__*/function () {
|
|
31
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
32
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
|
+
while (1) switch (_context.prev = _context.next) {
|
|
34
|
+
case 0:
|
|
35
|
+
_context.next = 2;
|
|
36
|
+
return languageInitPromise;
|
|
37
|
+
case 2:
|
|
38
|
+
(0, _client.createRoot)(document.getElementById('root')).render( /*#__PURE__*/_react["default"].createElement(App, null));
|
|
39
|
+
case 3:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
}));
|
|
45
|
+
return function render() {
|
|
46
|
+
return _ref.apply(this, arguments);
|
|
47
|
+
};
|
|
48
|
+
}();
|
|
49
|
+
var main = exports.main = /*#__PURE__*/function () {
|
|
50
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
51
|
+
var services;
|
|
52
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
_context2.next = 2;
|
|
56
|
+
return languageInitPromise;
|
|
57
|
+
case 2:
|
|
58
|
+
services = (0, _initServices.initServices)();
|
|
59
|
+
_ServiceLocator.Services.store.setStore(_Store.store);
|
|
60
|
+
services.configurator.initialize();
|
|
61
|
+
case 5:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context2.stop();
|
|
64
|
+
}
|
|
65
|
+
}, _callee2);
|
|
66
|
+
}));
|
|
67
|
+
return function main() {
|
|
68
|
+
return _ref2.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
}();
|
|
30
71
|
var _default = exports["default"] = App;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.49.
|
|
3
|
+
"version": "1.49.7",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/polyfill": "^7.12.1",
|
|
9
|
-
"@configuratorware/scripts": "1.49.
|
|
9
|
+
"@configuratorware/scripts": "1.49.7",
|
|
10
10
|
"@material-ui/core": "^4.12.4",
|
|
11
11
|
"@material-ui/icons": "^4.11.3",
|
|
12
12
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-router-dom": "^5.3.4",
|
|
37
37
|
"react-swipeable": "^5.5.1",
|
|
38
38
|
"react-zoom-pan-pinch": "^2.1.3",
|
|
39
|
-
"redhotmagma-graphics-editor": "1.49.
|
|
40
|
-
"redhotmagma-visualization": "1.49.
|
|
39
|
+
"redhotmagma-graphics-editor": "1.49.7",
|
|
40
|
+
"redhotmagma-visualization": "1.49.7",
|
|
41
41
|
"redux": "^4.1.0",
|
|
42
42
|
"redux-logger": "^3.0.6",
|
|
43
43
|
"redux-persist": "^5.10.0",
|
package/src/App/Store.js
CHANGED
|
@@ -13,7 +13,6 @@ import combinedReducers from './Reducers';
|
|
|
13
13
|
import deviceReducer from './Reducers/Device/Reducer';
|
|
14
14
|
import apiReducer from './Reducers/Reducer';
|
|
15
15
|
|
|
16
|
-
import { setStore as i18nSetStore } from '../Framework/i18n';
|
|
17
16
|
import { setInitialState } from './Reducers/GeneralActions';
|
|
18
17
|
|
|
19
18
|
const reduxPersistConfig = getConf('reduxPersist', { enabled: false });
|
|
@@ -60,7 +59,5 @@ store.dispatch(setInitialState());
|
|
|
60
59
|
|
|
61
60
|
// translation setup
|
|
62
61
|
syncTranslationWithStore(store);
|
|
63
|
-
// setup
|
|
64
|
-
i18nSetStore(store, getConf('language'));
|
|
65
62
|
|
|
66
63
|
export default store;
|
package/src/App/Translations.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { isProduction, getConf, setConf } from './configuration';
|
|
2
|
+
import Api from '../Framework/Api';
|
|
3
|
+
import { use, setStore } from '../Framework/i18n';
|
|
4
|
+
|
|
5
|
+
export async function loadTranslationFile(lang, baseURL) {
|
|
4
6
|
// ensure that the filename always has an underscore and no dash
|
|
5
7
|
const fileKey = lang.replace('-', '_');
|
|
6
8
|
const langKey = lang.substring(0, 2);
|
|
@@ -12,6 +14,7 @@ export async function initLanguage(lang, baseURL) {
|
|
|
12
14
|
loadLanguageJson('/translations_custom/' + fileKey + '.json', langKey),
|
|
13
15
|
]);
|
|
14
16
|
results.forEach(use);
|
|
17
|
+
return results;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
function loadLanguageJson(filename, langKey) {
|
|
@@ -39,3 +42,29 @@ function loadLanguageJson(filename, langKey) {
|
|
|
39
42
|
request.send();
|
|
40
43
|
});
|
|
41
44
|
}
|
|
45
|
+
|
|
46
|
+
export async function findInitialLanguage() {
|
|
47
|
+
const languages = (await Api.request({ url: 'languages' })).data;
|
|
48
|
+
let language = languages?.find(lang => lang.isDefault)?.iso; // priority for api default language
|
|
49
|
+
if (!language && languages?.length) {
|
|
50
|
+
const browserLanguage = (navigator.languages?.[0] || navigator.language).replace('-', '_');
|
|
51
|
+
const matchToBrowserLanguage = languages.find(lang => lang.iso === browserLanguage);
|
|
52
|
+
language = (matchToBrowserLanguage || languages[0])?.iso;
|
|
53
|
+
}
|
|
54
|
+
return language || 'de_DE';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function initLanguage(options = {}) {
|
|
58
|
+
const language = (getConf('language') || (await findInitialLanguage())).replace('_', '-');
|
|
59
|
+
setConf('language', language);
|
|
60
|
+
Api.setLanguage(language);
|
|
61
|
+
document.documentElement.lang = language.substring(0, 2);
|
|
62
|
+
const translations = await loadTranslationFile(language, getConf('network.baseURL'));
|
|
63
|
+
if (options?.store) {
|
|
64
|
+
setStore(options.store, language);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
language,
|
|
68
|
+
translations,
|
|
69
|
+
};
|
|
70
|
+
}
|
package/src/App/configuration.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import find from 'lodash/find';
|
|
3
|
-
import first from 'lodash/first';
|
|
4
2
|
import merge from 'lodash/merge';
|
|
5
3
|
import set from 'lodash/set';
|
|
6
4
|
import Api from '../Framework/Api';
|
|
7
|
-
import { initLanguage } from './Translations';
|
|
8
5
|
import hyphensDeDE from 'hyphenated-de';
|
|
9
6
|
|
|
10
7
|
import { setStateChangeReducers, setSubReducers } from './Reducers/Configurator/Reducer';
|
|
@@ -283,7 +280,6 @@ export function init() {
|
|
|
283
280
|
|
|
284
281
|
Api.init(applicationConfiguration.network);
|
|
285
282
|
|
|
286
|
-
setLanguage();
|
|
287
283
|
setDocumentDomain();
|
|
288
284
|
preventLeavingPage();
|
|
289
285
|
|
|
@@ -387,8 +383,6 @@ export function setConfiguration(customApplicationConfiguration) {
|
|
|
387
383
|
getQueryParams()
|
|
388
384
|
);
|
|
389
385
|
|
|
390
|
-
setLanguage();
|
|
391
|
-
|
|
392
386
|
// if there is a config for network Api instance defaults must be updated
|
|
393
387
|
if (applicationConfiguration.network) {
|
|
394
388
|
Api.init(applicationConfiguration.network);
|
|
@@ -402,45 +396,6 @@ export function setConfiguration(customApplicationConfiguration) {
|
|
|
402
396
|
}
|
|
403
397
|
}
|
|
404
398
|
|
|
405
|
-
function setLanguage() {
|
|
406
|
-
let language;
|
|
407
|
-
// if the default language is defined in the configuration
|
|
408
|
-
if (applicationConfiguration.language) {
|
|
409
|
-
language = applicationConfiguration.language;
|
|
410
|
-
}
|
|
411
|
-
// if there is a locales array in the configuration...
|
|
412
|
-
else if (applicationConfiguration.locales) {
|
|
413
|
-
const browserLanguage = get(navigator, 'languages[0]', navigator.language).replace('-', '_');
|
|
414
|
-
const matchToBrowserLanguage = find(applicationConfiguration.locales, { code: browserLanguage });
|
|
415
|
-
const preferred = find(applicationConfiguration.locales, { preferred: true });
|
|
416
|
-
|
|
417
|
-
// if there is a match with the browser language use that
|
|
418
|
-
if (matchToBrowserLanguage) {
|
|
419
|
-
language = matchToBrowserLanguage.code;
|
|
420
|
-
}
|
|
421
|
-
// if the preferred language is set use it
|
|
422
|
-
else if (preferred) {
|
|
423
|
-
language = preferred.code;
|
|
424
|
-
}
|
|
425
|
-
// otherwise use the first from the locales list
|
|
426
|
-
else {
|
|
427
|
-
language = first(applicationConfiguration.locales).code;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
// we have no info about the language, so try to use the browser language
|
|
431
|
-
else {
|
|
432
|
-
language = get(navigator, 'languages[0]', navigator.language).replace('-', '_') || 'de_DE';
|
|
433
|
-
}
|
|
434
|
-
if (!find(applicationConfiguration.locales, { code: language })) {
|
|
435
|
-
// eslint-disable-next-line no-console
|
|
436
|
-
console.warn(`The selected language (${language}) is not listed in the available languages!`);
|
|
437
|
-
}
|
|
438
|
-
applicationConfiguration.language = language.replace('_', '-');
|
|
439
|
-
Api.setLanguage(applicationConfiguration.language);
|
|
440
|
-
document.documentElement.lang = language.substring(0, 2);
|
|
441
|
-
initLanguage(applicationConfiguration.language, applicationConfiguration.network.baseURL);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
399
|
// backward compatibility alias
|
|
445
400
|
export const setCustomApplicationConfiguration = setConfiguration;
|
|
446
401
|
|
package/src/App/index.js
CHANGED
|
@@ -10,17 +10,23 @@ import Routing from './Routing';
|
|
|
10
10
|
import { store } from './Store';
|
|
11
11
|
import { Services } from './ServiceLocator';
|
|
12
12
|
|
|
13
|
+
import { initLanguage } from './Translations';
|
|
14
|
+
|
|
13
15
|
export const App = () => (
|
|
14
16
|
<Provider store={store}>
|
|
15
17
|
<Routing />
|
|
16
18
|
</Provider>
|
|
17
19
|
);
|
|
18
20
|
|
|
19
|
-
export const
|
|
21
|
+
export const languageInitPromise = initLanguage({ store });
|
|
22
|
+
|
|
23
|
+
export const render = async () => {
|
|
24
|
+
await languageInitPromise;
|
|
20
25
|
createRoot(document.getElementById('root')).render(<App />);
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
export const main = () => {
|
|
28
|
+
export const main = async () => {
|
|
29
|
+
await languageInitPromise;
|
|
24
30
|
const services = initServices();
|
|
25
31
|
Services.store.setStore(store);
|
|
26
32
|
services.configurator.initialize();
|