Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tolgee/core

Package Overview
Dependencies
Maintainers
1
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tolgee/core - npm Package Compare versions

Comparing version 1.0.0-alpha.35 to 1.0.0-alpha.36

15

dist/tolgee.commonjs.js.LICENSE.txt

@@ -17,2 +17,17 @@ /*! *****************************************************************************

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.

@@ -19,0 +34,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use

@@ -17,2 +17,17 @@ /*! *****************************************************************************

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.

@@ -19,0 +34,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use

@@ -17,2 +17,17 @@ /*! *****************************************************************************

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.

@@ -19,0 +34,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use

2

lib/services/TextService.d.ts

@@ -18,3 +18,3 @@ import { KeyAndParams, TranslationParams } from "../types";

private static parseUnwrapped;
private readonly replaceParams;
private readonly format;
private readonly escapeForRegExp;

@@ -21,0 +21,0 @@ private get rawUnWrapRegex();

@@ -69,2 +69,3 @@ "use strict";

var TextHelper_1 = require("../helpers/TextHelper");
var intl_messageformat_1 = require("intl-messageformat");
var TextService = /** @class */ (function () {

@@ -75,10 +76,12 @@ function TextService(properties, translationService) {

this.translationService = translationService;
this.replaceParams = function (translation, params) {
var result = translation;
var regExp = function (name) { return new RegExp("\\{\\{\\s*" + _this.escapeForRegExp(name) + "\\s*\\}\\}", "g"); };
Object.entries(params).forEach(function (_a) {
var _b = __read(_a, 2), name = _b[0], value = _b[1];
return result = result.replace(regExp(name), value);
});
return result;
this.format = function (translation, params) {
try {
return new intl_messageformat_1.default(translation, _this.properties.currentLanguage).format(params);
}
catch (e) {
if (e.code === "MISSING_VALUE") {
console.warn(e.message);
return e.translation;
}
}
};

@@ -98,3 +101,3 @@ this.escapeForRegExp = function (string) {

case 0:
_a = this.replaceParams;
_a = this.format;
return [4 /*yield*/, this.translationService.getTranslation(key, lang)];

@@ -108,3 +111,3 @@ case 1: return [2 /*return*/, _a.apply(this, [_b.sent(), params])];

if (lang === void 0) { lang = this.properties.currentLanguage; }
return this.replaceParams(this.translationService.getFromCacheOrFallback(key, lang, orEmpty), params);
return this.format(this.translationService.getFromCacheOrFallback(key, lang, orEmpty), params);
};

@@ -111,0 +114,0 @@ TextService.prototype.replace = function (text) {

{
"name": "@tolgee/core",
"version": "1.0.0-alpha.35",
"version": "1.0.0-alpha.36",
"description": "Library providing ability to translate messages directly in context of developed application.",

@@ -50,2 +50,3 @@ "main": "dist/tolgee.umd.js",

"@testing-library/jest-dom": "^5.11.4",
"@types/intl-messageformat": "^3.0.0",
"@types/jest": "^26.0.14",

@@ -64,2 +65,3 @@ "@types/node": "^14.14.22",

"html-webpack-plugin": "^4.5.0",
"intl-messageformat": "^9.5.3",
"jest": "^26.5.2",

@@ -78,3 +80,3 @@ "jest-fetch-mock": "^3.0.3",

},
"gitHead": "3dedc4712d6af8fcd0dad228d949a2b0b47f9fcc",
"gitHead": "47c34bb8db0a1058a5b611bac08556193123678f",
"publishConfig": {

@@ -81,0 +83,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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc