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

i18n-ui5

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-ui5 - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

14

lib/commands.js

@@ -56,5 +56,15 @@ /* eslint-disable no-console */

process.exit(1);
} else {
console.log(CONST.MESSAGES.NO_CHANGES.replace("{0}", parseArguments.destinationFile));
}
let duplicates = tokenUtils.determineDuplicates(generatedTokensStructureFromI18n);
if (duplicates.length) {
console.log(colors[colorMessageChanges](CONST.MESSAGES.FOUND_DUPLICATES));
duplicates.forEach((token) => {
console.log(
colors[CONST.COLORS.WARN](
CONST.MESSAGES.DUPLICATE.replace("{0}", token.line).replace("{1}", token.name)
)
);
});
}
console.log(CONST.MESSAGES.NO_CHANGES.replace("{0}", parseArguments.destinationFile));
})

@@ -61,0 +71,0 @@ .catch((err) => {

4

lib/const.js

@@ -71,3 +71,5 @@ "use strict";

FOUND_CHANGES: "\nFound {0} differences between tokens in source code and {1}!",
DESTINATION_FILE_UPDATED: "\nDestination file {0} has been updated!"
DESTINATION_FILE_UPDATED: "\nDestination file {0} has been updated!",
FOUND_DUPLICATES: "\nFound some duplicates!",
DUPLICATE: "Line {0} : {1}"
};

@@ -49,3 +49,3 @@ "use strict";

.split("\n")
.map((row) => {
.map((row, index) => {
let retval = {

@@ -66,2 +66,3 @@ type: CONST.TOKEN.UNDEF,

retval.value = match[3];
retval.line = index;
}

@@ -68,0 +69,0 @@ return retval;

@@ -11,2 +11,24 @@ /* eslint-disable no-console */

/**
* Check duplicates in the generated tokens
*
* @param {Array} generatedTokensStructureFromI18n - list of tokens from the source file
*
* @return {Object[]} list of duplicates
*/
exports.determineDuplicates = function (generatedTokensStructureFromI18n) {
const duplicates = [];
generatedTokensStructureFromI18n
.filter((token) => token.type === CONST.TOKEN.ACTIVE)
.forEach((...args) => {
const token = args[0];
const activeTokens = args[2];
if (activeTokens.filter((activeToken) => activeToken.name === token.name).length > 1) {
duplicates.push(token);
}
});
return duplicates;
};
exports.changesColor = function (generatedTokensStructureFromI18n) {

@@ -13,0 +35,0 @@ let warnings = generatedTokensStructureFromI18n.filter((token) => CONST.OPERATION.ADD !== token.operation).length;

{
"name": "i18n-ui5",
"version": "0.3.0",
"version": "0.4.0",
"description": "Simplify work with translations in OpenUI5 or SAPUI5 framework. The plugin searches views and source code of project in OpenUI5 or SAPUI5 framework for translation tokens and automatically update translation file used by the framework.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -49,3 +49,3 @@ # i18n-ui5

To ignroe more i18n tokens create `.i18nignore` file in root of your project and add tokens
To ignore more i18n tokens create `.i18nignore` file in root of your project and add tokens
to the file.

@@ -52,0 +52,0 @@

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