locize-cli 8.3.1 → 8.4.0
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/LICENSE +1 -1
- package/README.md +1 -0
- package/bin/locize +3 -0
- package/package.json +4 -4
- package/sync.js +14 -2
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
|
+
## [8.4.0](https://github.com/locize/locize-cli/compare/v8.3.1...v8.4.0) - 2024-12-23
|
|
9
|
+
|
|
10
|
+
- feat: add --auto-translate option for sync command [101](https://github.com/locize/locize-cli/pull/101)
|
|
11
|
+
|
|
8
12
|
## [8.3.1](https://github.com/locize/locize-cli/compare/v8.3.0...v8.3.1) - 2024-12-23
|
|
9
13
|
|
|
10
14
|
- special check for CVS (does not cleanup local language folders)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -146,6 +146,7 @@ locize sync --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-pro
|
|
|
146
146
|
- if you have less keys (you have deleted some keys) in your local namespace it will remove them in locize too
|
|
147
147
|
- all non reference languages will always be just locally replaced by what is published on locize, unless the *--skip-delete true* argument is used
|
|
148
148
|
- if you change the values of existing keys in the reference language, it will not change them in locize (to change the existing values you have to change it directly in locize or use the *--update-values true* argument)
|
|
149
|
+
- if you update existing keys (with *--update-values true*) the automatic translation is not triggered, unless the *--auto-translate true* argument us used
|
|
149
150
|
- **if you want to take into account all languages instead of the reference language only while comparing the namespace content between local and remote, you can use the command argument *--reference-language-only false***
|
|
150
151
|
- **if you want to take into account the modification time while comparing the namespace content between local and remote, you can use the command argument *--compare-modification-time true***
|
|
151
152
|
|
package/bin/locize
CHANGED
|
@@ -366,6 +366,7 @@ program
|
|
|
366
366
|
.option('-c, --clean <true|false>', 'Removes all local files by removing the whole folder (default: false)', 'false')
|
|
367
367
|
.option('-cf, --clean-local-files <true|false>', 'Removes all local files without removing any folder (default: false)', 'false')
|
|
368
368
|
.option('-u, --update-values <true|false>', 'This will update values of existing translations. (default: false)', 'false')
|
|
369
|
+
.option('--auto-translate <true|false>', 'This will trigger auto-translation of updated translations. (default: false)', 'false')
|
|
369
370
|
.option('-S, --skip-delete <true|false>', 'This will skip the removal of keys on locize. (default: false)', 'false')
|
|
370
371
|
.option('-D, --delete-remote-namespace <true|false>', 'This will delete a complete namespace on locize, if a local file in reference language was deleted. (default: false)', 'false')
|
|
371
372
|
.option('-m, --path-mask <mask>', 'This will define the folder and file structure; do not add a file extension (default: {{language}}/{{namespace}})', `{{language}}${path.sep}{{namespace}}`)
|
|
@@ -415,6 +416,7 @@ program
|
|
|
415
416
|
const cleanLocalFiles = options.cleanLocalFiles === 'true';
|
|
416
417
|
const dry = options.dry === 'true';
|
|
417
418
|
const updateValues = options.updateValues === 'true';
|
|
419
|
+
const autoTranslate = options.autoTranslate === 'true';
|
|
418
420
|
const skipDelete = options.skipDelete === 'true';
|
|
419
421
|
const deleteRemoteNamespace = options.deleteRemoteNamespace === 'true';
|
|
420
422
|
const languageFolderPrefix = options.languageFolderPrefix || '';
|
|
@@ -434,6 +436,7 @@ program
|
|
|
434
436
|
path: options.path,
|
|
435
437
|
format: options.format,
|
|
436
438
|
updateValues: updateValues,
|
|
439
|
+
autoTranslate: autoTranslate,
|
|
437
440
|
skipDelete: skipDelete,
|
|
438
441
|
deleteRemoteNamespace: deleteRemoteNamespace,
|
|
439
442
|
languageFolderPrefix: languageFolderPrefix,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locize-cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "locize cli to import locales",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"commander": "9.5.0",
|
|
16
16
|
"csvjson": "5.1.0",
|
|
17
17
|
"diff": "7.0.0",
|
|
18
|
-
"dotenv": "16.4.
|
|
18
|
+
"dotenv": "16.4.7",
|
|
19
19
|
"flat": "5.0.2",
|
|
20
20
|
"fluent_conv": "3.3.0",
|
|
21
21
|
"gettext-converter": "1.3.0",
|
|
22
|
-
"https-proxy-agent": "7.0.
|
|
22
|
+
"https-proxy-agent": "7.0.6",
|
|
23
23
|
"ini": "4.1.3",
|
|
24
24
|
"js-yaml": "4.1.0",
|
|
25
25
|
"laravelphp": "2.0.4",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"eslint": "8.56.0",
|
|
38
38
|
"gh-release": "7.0.2",
|
|
39
|
-
"@yao-pkg/pkg": "6.
|
|
39
|
+
"@yao-pkg/pkg": "6.2.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"lint": "eslint .",
|
package/sync.js
CHANGED
|
@@ -266,7 +266,19 @@ const update = (opt, lng, ns, shouldOmit, cb) => {
|
|
|
266
266
|
var payloadKeysLimit = 1000;
|
|
267
267
|
|
|
268
268
|
function send(d, so, clb, isRetrying) {
|
|
269
|
-
|
|
269
|
+
const queryParams = new URLSearchParams();
|
|
270
|
+
if (opt.autoTranslate) {
|
|
271
|
+
/** @See https://docs.locize.com/integration/api#optional-autotranslate */
|
|
272
|
+
queryParams.append('autotranslate', 'true');
|
|
273
|
+
}
|
|
274
|
+
if (so) {
|
|
275
|
+
// no API docs for this
|
|
276
|
+
queryParams.append('omitstatsgeneration', 'true');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const queryString = queryParams.size > 0 ? '?' + queryParams.toString() : '';
|
|
280
|
+
|
|
281
|
+
request(opt.apiPath + '/update/' + opt.projectId + '/' + opt.version + '/' + lng + '/' + ns.namespace + queryString, {
|
|
270
282
|
method: 'post',
|
|
271
283
|
body: d,
|
|
272
284
|
headers: {
|
|
@@ -481,7 +493,7 @@ const handleSync = (opt, remoteLanguages, localNamespaces, cb) => {
|
|
|
481
493
|
}
|
|
482
494
|
if (opt.updateValues) {
|
|
483
495
|
if (ns.diff.toUpdate.length > 0) {
|
|
484
|
-
console.log(colors.yellow(`updating ${ns.diff.toUpdate.length} keys in ${ns.language}/${ns.namespace}...`));
|
|
496
|
+
console.log(colors.yellow(`updating ${ns.diff.toUpdate.length} keys in ${ns.language}/${ns.namespace}${opt.autoTranslate ? ' with automatic translation' : ''}...`));
|
|
485
497
|
if (opt.dry) console.log(colors.yellow(`would update ${ns.diff.toUpdate.join(', ')} in ${ns.language}/${ns.namespace}...`));
|
|
486
498
|
}
|
|
487
499
|
if (ns.diff.toUpdateLocally.length > 0) {
|