locize-cli 9.0.1 → 9.0.2
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.
- package/CHANGELOG.md +4 -0
- package/download.js +4 -4
- package/format.js +1 -1
- package/package.json +4 -4
- package/sync.js +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
Project versioning adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
7
7
|
|
|
8
|
+
## [9.0.2](https://github.com/locize/locize-cli/compare/v9.0.1...v9.0.2) - 2025-04-25
|
|
9
|
+
|
|
10
|
+
- Hint: `Using the "--auto-translate true" option together with the "--reference-language-only false" option might result in inconsistent target language translations (automatic translation vs. what is sent direcly to locize).`
|
|
11
|
+
|
|
8
12
|
## [9.0.1](https://github.com/locize/locize-cli/compare/v9.0.0...v9.0.1) - 2025-04-04
|
|
9
13
|
|
|
10
14
|
- optimize xcstrings format [106](https://github.com/locize/locize-cli/issues/106)
|
package/download.js
CHANGED
|
@@ -93,7 +93,7 @@ function handleDownload(opt, url, err, res, downloads, cb) {
|
|
|
93
93
|
if (clb) clb(null);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
96
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
97
97
|
if (!opt.version) {
|
|
98
98
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, version, mkdirPath));
|
|
99
99
|
fs.writeFile(path.join(opt.path, version, filledMask), fileContent, logAndClb);
|
|
@@ -145,7 +145,7 @@ function handleDownload(opt, url, err, res, downloads, cb) {
|
|
|
145
145
|
if (filledMask.lastIndexOf(path.sep) > 0) {
|
|
146
146
|
mkdirPath = filledMask.substring(0, filledMask.lastIndexOf(path.sep));
|
|
147
147
|
}
|
|
148
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
148
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
149
149
|
if (!opt.version) {
|
|
150
150
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, version, mkdirPath));
|
|
151
151
|
fs.writeFile(path.join(opt.path, version, filledMask), fileContent, clb);
|
|
@@ -232,7 +232,7 @@ function handlePull(opt, toDownload, cb) {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, mkdirPath));
|
|
235
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
235
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
236
236
|
fs.writeFile(path.join(opt.path, filledMask), fileContent, logAndClb);
|
|
237
237
|
} catch (e) {
|
|
238
238
|
err.message = 'Invalid content for "' + opt.format + '" format!\n' + (err.message || '');
|
|
@@ -276,7 +276,7 @@ function handlePull(opt, toDownload, cb) {
|
|
|
276
276
|
if (filledMask.lastIndexOf(path.sep) > 0) {
|
|
277
277
|
mkdirPath = filledMask.substring(0, filledMask.lastIndexOf(path.sep));
|
|
278
278
|
}
|
|
279
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
279
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
280
280
|
if (!opt.language) {
|
|
281
281
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, mkdirPath));
|
|
282
282
|
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
package/format.js
CHANGED
|
@@ -113,7 +113,7 @@ function writeLocalFile(opt, file, clb) {
|
|
|
113
113
|
return clb(null, true);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
const fileContent = opt.format !== 'xlsx' ? (file.converted + '\n') : file.converted;
|
|
116
|
+
const fileContent = (opt.format !== 'xlsx' && !file.converted.endsWith('\n')) ? (file.converted + '\n') : file.converted;
|
|
117
117
|
|
|
118
118
|
fs.writeFile(file.path, fileContent, (err) => clb(err, true));
|
|
119
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locize-cli",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "locize cli to import locales",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"commander": "9.5.0",
|
|
16
16
|
"csvjson": "5.1.0",
|
|
17
17
|
"diff": "7.0.0",
|
|
18
|
-
"dotenv": "16.
|
|
18
|
+
"dotenv": "16.5.0",
|
|
19
19
|
"flat": "5.0.2",
|
|
20
20
|
"fluent_conv": "3.3.0",
|
|
21
21
|
"gettext-converter": "1.3.0",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"rimraf": "4.4.1",
|
|
32
32
|
"strings-file": "0.0.5",
|
|
33
33
|
"tmexchange": "2.0.5",
|
|
34
|
-
"xliff": "6.2.
|
|
34
|
+
"xliff": "6.2.2",
|
|
35
35
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@yao-pkg/pkg": "6.
|
|
38
|
+
"@yao-pkg/pkg": "6.4.0",
|
|
39
39
|
"eslint": "8.56.0",
|
|
40
40
|
"gh-release": "7.0.2"
|
|
41
41
|
},
|
package/sync.js
CHANGED
|
@@ -267,7 +267,7 @@ const downloadAll = (opt, remoteLanguages, omitRef, manipulate, cb) => {
|
|
|
267
267
|
}
|
|
268
268
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
269
269
|
mkdirp.sync(parentDir);
|
|
270
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
270
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
271
271
|
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
272
272
|
} catch (e) {
|
|
273
273
|
err.message = 'Invalid content for "' + opt.format + '" format!\n' + (err.message || '');
|
|
@@ -307,7 +307,7 @@ const downloadAll = (opt, remoteLanguages, omitRef, manipulate, cb) => {
|
|
|
307
307
|
}
|
|
308
308
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
309
309
|
mkdirp.sync(parentDir);
|
|
310
|
-
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
310
|
+
const fileContent = (opt.format !== 'xlsx' && !converted.endsWith('\n')) ? (converted + '\n') : converted;
|
|
311
311
|
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
312
312
|
});
|
|
313
313
|
});
|
|
@@ -335,7 +335,7 @@ const update = (opt, lng, ns, shouldOmit, cb) => {
|
|
|
335
335
|
|
|
336
336
|
function send(d, so, clb, isRetrying) {
|
|
337
337
|
const queryParams = new URLSearchParams();
|
|
338
|
-
if (opt.autoTranslate) {
|
|
338
|
+
if (opt.autoTranslate && lng === opt.referenceLanguage) {
|
|
339
339
|
/** @See https://www.locize.com/docs/api#optional-autotranslate */
|
|
340
340
|
queryParams.append('autotranslate', 'true');
|
|
341
341
|
}
|
|
@@ -489,7 +489,7 @@ const backupDeleted = (opt, ns, now) => {
|
|
|
489
489
|
}, {});
|
|
490
490
|
mkdirp.sync(path.join(currentBackupPath, ns.language));
|
|
491
491
|
const content = JSON.stringify(removingRemote, null, 2);
|
|
492
|
-
const fileContent = opt.format !== 'xlsx' ? (content + '\n') : content;
|
|
492
|
+
const fileContent = (opt.format !== 'xlsx' && !content.endsWith('\n')) ? (content + '\n') : content;
|
|
493
493
|
fs.writeFileSync(path.join(currentBackupPath, ns.language, `${ns.namespace}.json`), fileContent);
|
|
494
494
|
};
|
|
495
495
|
|
|
@@ -665,6 +665,10 @@ const sync = (opt, cb) => {
|
|
|
665
665
|
return handleError(new Error(`${opt.format} is not a valid format!`), cb);
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
+
if (opt.autoTranslate && !opt.referenceLanguageOnly) {
|
|
669
|
+
console.log(colors.yellow('Using the "--auto-translate true" option together with the "--reference-language-only false" option might result in inconsistent target language translations (automatic translation vs. what is sent direcly to locize).'));
|
|
670
|
+
}
|
|
671
|
+
|
|
668
672
|
opt.version = opt.version || 'latest';
|
|
669
673
|
opt.apiPath = opt.apiPath || 'https://api.locize.app';
|
|
670
674
|
|