@tolgee/core
Advanced tools
Comparing version 1.9.0 to 2.0.0
@@ -73,12 +73,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
try { | ||
return new IntlMessageFormat(translation, _this.properties.currentLanguage, undefined, { | ||
ignoreTag: true, | ||
}).format(params); | ||
//try to format the text | ||
return new IntlMessageFormat(translation, _this.properties.currentLanguage).format(params); | ||
} | ||
catch (e) { | ||
if (e.code === 'MISSING_VALUE') { | ||
// eslint-disable-next-line no-console | ||
console.warn(e.message); | ||
return translation; | ||
} | ||
// if string cannot be formatted, throw error | ||
// eslint-disable-next-line no-console | ||
console.error(e); | ||
} | ||
@@ -189,3 +186,3 @@ }; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a; | ||
var result, _a; | ||
return __generator(this, function (_b) { | ||
@@ -196,3 +193,8 @@ switch (_b.label) { | ||
return [4 /*yield*/, this.translationService.getTranslation(key, lang, orEmpty, defaultValue)]; | ||
case 1: return [2 /*return*/, _a.apply(this, [_b.sent(), params])]; | ||
case 1: | ||
result = _a.apply(this, [_b.sent(), params]); | ||
if (result !== undefined) { | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/, key]; | ||
} | ||
@@ -204,3 +206,7 @@ }); | ||
if (lang === void 0) { lang = this.properties.currentLanguage; } | ||
return this.format(this.translationService.getFromCacheOrFallback(key, lang, orEmpty, defaultValue), params); | ||
var result = this.format(this.translationService.getFromCacheOrFallback(key, lang, orEmpty, defaultValue), params); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
return key; | ||
}; | ||
@@ -207,0 +213,0 @@ TextService.prototype.replace = function (text) { |
{ | ||
"name": "@tolgee/core", | ||
"version": "1.9.0", | ||
"version": "2.0.0", | ||
"description": "Library providing ability to translate messages directly in context of developed application.", | ||
@@ -61,3 +61,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "7dde9ae29f37c62d988de554f7eb79b52b36886c", | ||
"gitHead": "420df902ef07bf3d19cec19e53f2a61a6f49aef5", | ||
"publishConfig": { | ||
@@ -64,0 +64,0 @@ "access": "public" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2769175
23320