locize-cli 8.3.1 → 8.5.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 +8 -0
- package/LICENSE +1 -1
- package/README.md +1 -0
- package/bin/locize +8 -1
- package/package.json +5 -5
- package/publishVersion.js +1 -1
- package/sync.js +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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.5.0](https://github.com/locize/locize-cli/compare/v8.4.0...v8.5.0) - 2025-02-18
|
|
9
|
+
|
|
10
|
+
- feat: add --tenants option for publish version command [102](https://github.com/locize/locize-cli/issues/102)
|
|
11
|
+
|
|
12
|
+
## [8.4.0](https://github.com/locize/locize-cli/compare/v8.3.1...v8.4.0) - 2024-12-23
|
|
13
|
+
|
|
14
|
+
- feat: add --auto-translate option for sync command [101](https://github.com/locize/locize-cli/pull/101)
|
|
15
|
+
|
|
8
16
|
## [8.3.1](https://github.com/locize/locize-cli/compare/v8.3.0...v8.3.1) - 2024-12-23
|
|
9
17
|
|
|
10
18
|
- 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,
|
|
@@ -596,6 +599,7 @@ program
|
|
|
596
599
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
597
600
|
.option('-v, --ver <version>', 'The version to be used to publish (default: latest)')
|
|
598
601
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
602
|
+
.option('-t, --tenants <true|false>', 'Publish also tenants (if using multi-tenant setup) (default: false)', 'false')
|
|
599
603
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
600
604
|
.action((options) => {
|
|
601
605
|
try {
|
|
@@ -620,11 +624,14 @@ program
|
|
|
620
624
|
|
|
621
625
|
const getPath = options.getPath || config.getPath || getPathUrl;
|
|
622
626
|
|
|
627
|
+
const tenants = options.tenants === 'true';
|
|
628
|
+
|
|
623
629
|
publishVersion({
|
|
624
630
|
apiKey: apiKey,
|
|
625
631
|
projectId: projectId,
|
|
626
632
|
apiPath: url.parse(getPath).protocol + '//' + url.parse(getPath).host,
|
|
627
|
-
version: version
|
|
633
|
+
version: version,
|
|
634
|
+
tenants: tenants
|
|
628
635
|
});
|
|
629
636
|
})
|
|
630
637
|
.on('--help', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locize-cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.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,12 +36,12 @@
|
|
|
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 .",
|
|
43
43
|
"test": "npm run lint",
|
|
44
|
-
"pkg": "mkdir -p ./bins && pkg ./bin/locize --out-path ./bins --targets
|
|
44
|
+
"pkg": "mkdir -p ./bins && pkg ./bin/locize --out-path ./bins --targets node22-linux-x64,node22-macos-x64,node22-win-x64,node22-alpine-x64",
|
|
45
45
|
"release": "gh-release --assets ./bins/locize-linux,./bins/locize-macos,./bins/locize-win.exe,./bins/locize-alpine",
|
|
46
46
|
"version": "npm run pkg",
|
|
47
47
|
"postversion": "git push && npm run release"
|
package/publishVersion.js
CHANGED
|
@@ -3,7 +3,7 @@ const request = require('./request');
|
|
|
3
3
|
const getJob = require('./getJob');
|
|
4
4
|
|
|
5
5
|
const publishVersion = (opt, cb) => {
|
|
6
|
-
request(opt.apiPath + '/publish/' + opt.projectId + '/' + opt.version, {
|
|
6
|
+
request(opt.apiPath + '/publish/' + opt.projectId + '/' + opt.version + (opt.tenants ? '?tenants=true' : ''), {
|
|
7
7
|
method: 'post',
|
|
8
8
|
headers: {
|
|
9
9
|
'Authorization': opt.apiKey
|
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) {
|