@stemy/backend 3.5.7 → 3.5.8
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.
|
@@ -4075,18 +4075,20 @@
|
|
|
4075
4075
|
exports.Translator = /** @class */ (function () {
|
|
4076
4076
|
function Translator(translationProvider) {
|
|
4077
4077
|
this.translationProvider = translationProvider;
|
|
4078
|
-
this.
|
|
4078
|
+
this.dictionaries = {};
|
|
4079
4079
|
}
|
|
4080
4080
|
Translator.prototype.getDictionary = function (language) {
|
|
4081
4081
|
return __awaiter$g(this, void 0, void 0, function () {
|
|
4082
|
-
var
|
|
4083
|
-
return __generator(this, function (
|
|
4084
|
-
switch (
|
|
4085
|
-
case 0:
|
|
4082
|
+
var _a, _b;
|
|
4083
|
+
return __generator(this, function (_c) {
|
|
4084
|
+
switch (_c.label) {
|
|
4085
|
+
case 0:
|
|
4086
|
+
_a = this.dictionaries;
|
|
4087
|
+
_b = language;
|
|
4088
|
+
return [4 /*yield*/, this.translationProvider.getDictionary(language)];
|
|
4086
4089
|
case 1:
|
|
4087
|
-
|
|
4088
|
-
this.
|
|
4089
|
-
return [2 /*return*/, dictionary];
|
|
4090
|
+
_a[_b] = _c.sent();
|
|
4091
|
+
return [2 /*return*/, this.dictionaries[language]];
|
|
4090
4092
|
}
|
|
4091
4093
|
});
|
|
4092
4094
|
});
|
|
@@ -4095,7 +4097,7 @@
|
|
|
4095
4097
|
if (!isString(key) || !key.length) {
|
|
4096
4098
|
throw new Error("Parameter \"key\" required");
|
|
4097
4099
|
}
|
|
4098
|
-
var dictionary = this.
|
|
4100
|
+
var dictionary = this.dictionaries[language];
|
|
4099
4101
|
var translation = getValue(dictionary, key, key) || key;
|
|
4100
4102
|
return this.interpolate(translation, params);
|
|
4101
4103
|
};
|