Socket
Socket
Sign inDemoInstall

@talend/i18n-scripts

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@talend/i18n-scripts - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

2

doc/deploy.md

@@ -23,3 +23,3 @@ # Deploy

"github": {
"url": "https://github.com/Talend/locales.git"
"url": "https://github.com/Talend/i18n-product.git"
},

@@ -26,0 +26,0 @@ "module": {

@@ -40,3 +40,4 @@ # Upload/Download

"load": {
"project": "UI"
"project": "UI",
"fixQuote": true
}

@@ -49,3 +50,4 @@ }

| project | The XTM project name. |
| fixQuote | transforms odd numbers of quote on properties files |
It will download only the files corresponding to the current version of your project (version extracted). If no version is detected, all versions will be downloaded.
{
"name": "@talend/i18n-scripts",
"description": "Set of scripts to ease i18n workflow",
"version": "0.6.1",
"version": "0.7.0",
"license": "Apache-2.0",

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

@@ -11,2 +11,38 @@ const fs = require('fs');

// find odd number of following quote and capture them
const REGEX_SINGLE_QUOTE = /([^']|^)'('')*(?!')/g;
function replaceOddQuote(fileName) {
const content = fs.readFileSync(fileName, 'utf-8');
const newValue = content.replace(REGEX_SINGLE_QUOTE, '$&\'');
fs.writeFileSync(fileName, newValue);
}
function findPropertiesFiles(currentPath) {
const propsFiles = [];
if (!fs.existsSync(currentPath)){
return propsFiles;
}
fs.readdirSync(currentPath).forEach(file => {
const filename = path.join(currentPath,file);
if ( fs.lstatSync(filename).isDirectory()){
propsFiles.push(...findPropertiesFiles(filename));
} else if (filename.endsWith('.properties')) {
propsFiles.push(filename);
}
});
return propsFiles;
}
function fixOddQuote(data) {
const { targetPath, fixQuote} = data;
if (fixQuote) {
fs.readdirSync(targetPath)
.map(currentFolder => path.join(targetPath, currentFolder))
.flatMap(findPropertiesFiles)
.forEach(replaceOddQuote);
}
return data;
}
function unzip(data) {

@@ -66,2 +102,3 @@ const { targetPath } = data;

version: getVersion(),
fixQuote: load.fixQuote
};

@@ -74,2 +111,3 @@ printSection('XTM');

.then(unzip)
.then(fixOddQuote)
.then(reshapeFolders)

@@ -76,0 +114,0 @@ .catch(e => {

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