locize-cli 8.5.1 → 8.6.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 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.6.0](https://github.com/locize/locize-cli/compare/v8.5.1...v8.6.0) - 2025-03-10
9
+
10
+ - introduce .yml yaml format variats to address [104](https://github.com/locize/locize-cli/issues/104)
11
+
8
12
  ## [8.5.1](https://github.com/locize/locize-cli/compare/v8.5.0...v8.5.1) - 2025-02-19
9
13
 
10
14
  - downgrade binary generation to node v20 to try to address [103](https://github.com/locize/locize-cli/issues/103)
package/README.md CHANGED
@@ -67,7 +67,7 @@ locize get common title
67
67
 
68
68
  ## Download current published files
69
69
 
70
- *The CLI will use the normal [API](https://docs.locize.com/integration/api) endpoints to download the translations, so normal download charges etc. will occur.*
70
+ *The CLI will use the normal [API](https://www.locize.com/docs/api) endpoints to download the translations, so normal download charges etc. will occur.*
71
71
 
72
72
  ### Step 1: execute
73
73
 
@@ -84,7 +84,7 @@ or
84
84
  locize download
85
85
  ```
86
86
 
87
- or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
87
+ or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
88
88
 
89
89
  ```sh
90
90
  locize download --project-id my-project-id-93e1-442a-ab35-24331fa294ba --ver latest --language en --namespace namespace1 --path ./backup --format android
@@ -99,9 +99,9 @@ There's also a [GitHub Action](https://github.com/marketplace/actions/locize-dow
99
99
  By using the sync command, you can keep your existing code setup and synchronize the translations with locize.
100
100
  An example on how this could look like can be seen in [this tutorial](https://github.com/locize/react-tutorial#step-1---keep-existing-code-setup-but-synchronize-with-locize).
101
101
 
102
- **⚠️ Since the remote source are the published translations, make sure the desired version is set to auto publish mode. Alternatively use the `--unpublished true` argument (this will generate [private downloads costs](https://docs.locize.com/integration/api#fetch-filter-the-unpublished-namespace-resources)). ⚠️**
102
+ **⚠️ Since the remote source are the published translations, make sure the desired version is set to auto publish mode. Alternatively use the `--unpublished true` argument (this will generate [private downloads costs](https://www.locize.com/docs/api#fetch-filter-the-unpublished-namespace-resources)). ⚠️**
103
103
 
104
- *The CLI will use the normal [API](https://docs.locize.com/integration/api) endpoints, so normal modification and download charges etc. will occur.*
104
+ *The CLI will use the normal [API](https://www.locize.com/docs/api) endpoints, so normal modification and download charges etc. will occur.*
105
105
 
106
106
  *If you need to change or remove multiple keys, please do NOT execute the sync command after each individual key change, but make the changes all together and then execute the sync command once.*
107
107
 
@@ -133,7 +133,7 @@ Add your api-key and your project-id and let's go...
133
133
  locize sync --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba
134
134
  ```
135
135
 
136
- or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
136
+ or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
137
137
 
138
138
  ```sh
139
139
  locize sync --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba --format android
@@ -158,7 +158,7 @@ Navigate to your locize project and check the results => [www.locize.app](https:
158
158
 
159
159
  ## Push missing keys to locize from your repository (or any other local directory)
160
160
  This is useful, when i.e. using [i18next-scanner](https://github.com/i18next/i18next-scanner), like described [here](https://github.com/locize/i18next-locize-backend/issues/315#issuecomment-586967039).
161
- The save-missing command uses the [missing API](https://docs.locize.com/integration/api#missing-translations) and the sync command uses the [update API](https://docs.locize.com/integration/api#update-remove-translations)
161
+ The save-missing command uses the [missing API](https://www.locize.com/docs/api#missing-translations) and the sync command uses the [update API](https://www.locize.com/docs/api#update-remove-translations)
162
162
  So, if you want to save new keys (that does not exist in locize), the save-missing command is the better choice.
163
163
  Doing so, you can then for example make use of the “created by missing API" filter in the locize UI.
164
164
 
@@ -192,7 +192,7 @@ Add your api-key and your project-id and let's go...
192
192
  locize save-missing --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba
193
193
  ```
194
194
 
195
- or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
195
+ or add a format like (json, nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties)
196
196
 
197
197
  ```sh
198
198
  locize save-missing --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba --format android
@@ -205,7 +205,7 @@ Navigate to your locize project and check the results => [www.locize.app](https:
205
205
 
206
206
  ## Copy version
207
207
 
208
- *It uses this [API endpoint](https://docs.locize.com/integration/api#copy-version) and it's the same behavior like [overwriting](https://github.com/more/versioning#a-overwrite-with-data-from) via the UI.*
208
+ *It uses this [API endpoint](https://www.locize.com/docs/api#copy-version) and it's the same behavior like [overwriting](https://github.com/more/versioning#a-overwrite-with-data-from) via the UI.*
209
209
 
210
210
  ### Step 1: execute
211
211
 
package/bin/locize CHANGED
@@ -232,7 +232,7 @@ program
232
232
  .option('-p, --path <path>', `Specify the path that should be used (default: ${process.cwd()})`, process.cwd())
233
233
  .option('-g, --get-path <url>', `Specify the get-path url that should be used (default: ${getPathUrl})`)
234
234
  .option('-k, --api-key <apiKey>', 'The api-key that should be used')
235
- .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
235
+ .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
236
236
  .option('-s, --skip-empty <true|false>', 'Skips to download empty files (default: true)', 'true')
237
237
  .option('-P, --language-folder-prefix <prefix>', 'This will be added as a local folder name prefix in front of the language.', '')
238
238
  .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}}`)
@@ -361,7 +361,7 @@ program
361
361
  .option('-p, --path <path>', `Specify the path that should be used (default: ${process.cwd()})`, process.cwd())
362
362
  .option('-B, --backup-deleted-path <path>', 'Saves the segments that will be deleted in this path')
363
363
  .option('-A, --auto-create-path <true|false>', 'This will automatically make sure the --path is created. (default: true)', 'true')
364
- .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
364
+ .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
365
365
  .option('-s, --skip-empty <true|false>', 'Skips to download empty files (default: false)', 'false')
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')
@@ -472,7 +472,7 @@ program
472
472
  .option('-i, --project-id <projectId>', 'The project-id that should be used')
473
473
  .option('-v, --ver <version>', 'Found namespaces will be matched to this version (default: latest)')
474
474
  .option('-p, --path <path>', `Specify the path that should be used (default: ${process.cwd()})`, process.cwd())
475
- .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
475
+ .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
476
476
  .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}}`)
477
477
  .option('-P, --language-folder-prefix <prefix>', 'This will be added as a local folder name prefix in front of the language.', '')
478
478
  .option('-d, --dry <true|false>', 'Dry run (default: false)', 'false')
@@ -695,7 +695,7 @@ program
695
695
  .command('format [fileOrDirectory]')
696
696
  .alias('ft')
697
697
  .description('format local files')
698
- .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
698
+ .option('-f, --format <json>', 'File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
699
699
  .option('-l, --reference-language <lng>', 'Some format conversions need to know the reference language.', 'en')
700
700
  .option('-d, --dry <true|false>', 'Dry run (default: false)', 'false')
701
701
  .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
@@ -139,17 +139,26 @@ const convertToDesiredFormat = (
139
139
  });
140
140
  return;
141
141
  }
142
- if (opt.format === 'yaml') {
142
+ if (
143
+ opt.format === 'yaml' ||
144
+ opt.format === 'yml'
145
+ ) {
143
146
  if (isEmpty) return cb(null, '');
144
147
  cb(null, jsyaml.dump(flatten(data)));
145
148
  return;
146
149
  }
147
- if (opt.format === 'yaml-nested') {
150
+ if (
151
+ opt.format === 'yaml-nested' ||
152
+ opt.format === 'yml-nested'
153
+ ) {
148
154
  if (isEmpty) return cb(null, '');
149
155
  cb(null, jsyaml.dump(shouldUnflatten(data) ? unflatten(data) : data));
150
156
  return;
151
157
  }
152
- if (opt.format === 'yaml-rails') {
158
+ if (
159
+ opt.format === 'yaml-rails' ||
160
+ opt.format === 'yml-rails'
161
+ ) {
153
162
  if (isEmpty) return cb(null, '');
154
163
  var newData = {};
155
164
  newData[lng] = {};
package/formats.js CHANGED
@@ -6,6 +6,7 @@ const fileExtensionsMap = {
6
6
  '.csv': ['csv'],
7
7
  '.resx': ['resx'],
8
8
  '.yaml': ['yaml', 'yaml-rails', 'yaml-nested'],
9
+ '.yml': ['yml', 'yml-rails', 'yml-nested'],
9
10
  '.xlsx': ['xlsx'],
10
11
  '.xliff': ['xliff2', 'xliff12'],
11
12
  '.xlf': ['xlf2', 'xlf12'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "8.5.1",
3
+ "version": "8.6.0",
4
4
  "description": "locize cli to import locales",
5
5
  "main": "index.js",
6
6
  "bin": {
package/sync.js CHANGED
@@ -268,7 +268,7 @@ const update = (opt, lng, ns, shouldOmit, cb) => {
268
268
  function send(d, so, clb, isRetrying) {
269
269
  const queryParams = new URLSearchParams();
270
270
  if (opt.autoTranslate) {
271
- /** @See https://docs.locize.com/integration/api#optional-autotranslate */
271
+ /** @See https://www.locize.com/docs/api#optional-autotranslate */
272
272
  queryParams.append('autotranslate', 'true');
273
273
  }
274
274
  if (so) {