@tolgee/cli 2.6.0 → 2.8.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.
@@ -136,5 +136,5 @@ export default (config) => new Command()
136
136
  .addOption(new Option('-l, --languages <languages...>', 'Specifies which languages should be pushed (see push.files in config).').default(config.push?.languages))
137
137
  .addOption(new Option('-n, --namespaces <namespaces...>', 'Specifies which namespaces should be pushed (see push.files in config).').default(config.push?.namespaces))
138
138
  .addOption(new Option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.').default(config.push?.tagNewKeys))
139
- .addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import.').default(false))
139
+ .addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import.').default(config.push?.removeOtherKeys))
140
140
  .action(pushHandler(config));
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import ansi from 'ansi-colors';
3
3
  import { extractKeysOfFiles, filterExtractionResult, } from '../../extractor/runner.js';
4
4
  import { dumpWarnings } from '../../extractor/warnings.js';
@@ -113,9 +113,9 @@ const syncHandler = (config) => async function () {
113
113
  export default (config) => new Command()
114
114
  .name('sync')
115
115
  .description('Synchronizes the keys in your code project and in the Tolgee project, by creating missing keys and optionally deleting unused ones. For a dry-run, use `tolgee compare`.')
116
- .option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.')
117
- .option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.')
118
- .option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.')
119
- .option('--remove-unused', 'Also delete unused keys from the Tolgee project.')
116
+ .addOption(new Option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.').default(config.sync?.backup ?? false))
117
+ .addOption(new Option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.').default(config.sync?.continueOnWarning ?? false))
118
+ .addOption(new Option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.').default(false))
119
+ .addOption(new Option('--remove-unused', 'Delete unused keys from the Tolgee project.').default(config.sync?.removeUnused ?? false))
120
120
  .option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.')
121
121
  .action(syncHandler(config));
@@ -34,12 +34,12 @@ const tagHandler = (config) => async function () {
34
34
  };
35
35
  export default (config) => new Command('tag')
36
36
  .description('Update tags in your project.')
37
- .addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.'))
38
- .addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.'))
39
- .addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.'))
40
- .addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.'))
41
- .addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.'))
42
- .addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.'))
43
- .addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.'))
44
- .addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.'))
37
+ .addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.').default(config.tag?.filterExtracted))
38
+ .addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.').default(config.tag?.filterNotExtracted))
39
+ .addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.').default(config.tag?.filterTag))
40
+ .addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.').default(config.tag?.filterNoTag))
41
+ .addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.').default(config.tag?.tag))
42
+ .addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.').default(config.tag?.tagOther))
43
+ .addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.').default(config.tag?.untag))
44
+ .addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.').default(config.tag?.untagOther))
45
45
  .action(tagHandler(config));
package/dist/options.js CHANGED
@@ -31,6 +31,7 @@ export const CONFIG_OPT = new Option('-c, --config [config]', 'A path to tolgeer
31
31
  export const FORMAT_OPT = new Option('--format <format>', 'Localization files format.').choices([
32
32
  'JSON_TOLGEE',
33
33
  'JSON_ICU',
34
+ 'JSON_I18NEXT',
34
35
  'JSON_JAVA',
35
36
  'JSON_PHP',
36
37
  'JSON_RUBY',
@@ -40,12 +41,18 @@ export const FORMAT_OPT = new Option('--format <format>', 'Localization files fo
40
41
  'PO_JAVA',
41
42
  'PO_ICU',
42
43
  'PO_RUBY',
44
+ 'PO_PYTHON',
43
45
  'APPLE_STRINGS',
44
46
  'APPLE_XLIFF',
45
47
  'PROPERTIES_ICU',
46
48
  'PROPERTIES_JAVA',
47
49
  'ANDROID_XML',
50
+ 'COMPOSE_XML',
48
51
  'FLUTTER_ARB',
52
+ 'CSV_ICU',
53
+ 'CSV_JAVA',
54
+ 'CSV_PHP',
55
+ 'CSV_RUBY',
49
56
  'YAML_RUBY',
50
57
  'YAML_JAVA',
51
58
  'YAML_ICU',
@@ -54,6 +61,11 @@ export const FORMAT_OPT = new Option('--format <format>', 'Localization files fo
54
61
  'XLIFF_JAVA',
55
62
  'XLIFF_PHP',
56
63
  'XLIFF_RUBY',
64
+ 'RESX_ICU',
65
+ 'XLSX_ICU',
66
+ 'XLSX_JAVA',
67
+ 'XLSX_PHP',
68
+ 'XLSX_RUBY',
57
69
  ]);
58
70
  export const FILE_PATTERNS = new Option('-pt, --patterns <patterns...>', 'File glob patterns to include (hint: make sure to escape it in quotes, or your shell might attempt to unroll some tokens like *)');
59
71
  export const STRICT_NAMESPACE = new Option('--strict-namespace').hideHelp(true);
@@ -9,6 +9,8 @@ export const mapExportFormat = (format) => {
9
9
  };
10
10
  case 'APPLE_XLIFF':
11
11
  return { format: 'APPLE_XLIFF', messageFormat: 'APPLE_SPRINTF' };
12
+ case 'COMPOSE_XML':
13
+ return { format: 'COMPOSE_XML', messageFormat: 'JAVA_STRING_FORMAT' };
12
14
  case 'FLUTTER_ARB':
13
15
  return { format: 'FLUTTER_ARB', messageFormat: 'ICU' };
14
16
  case 'JSON_C':
@@ -35,6 +37,8 @@ export const mapExportFormat = (format) => {
35
37
  return { format: 'PO', messageFormat: 'PHP_SPRINTF' };
36
38
  case 'PO_RUBY':
37
39
  return { format: 'PO', messageFormat: 'RUBY_SPRINTF' };
40
+ case 'PO_PYTHON':
41
+ return { format: 'PO', messageFormat: 'PYTHON_PERCENT' };
38
42
  case 'PROPERTIES_ICU':
39
43
  return {
40
44
  format: 'PROPERTIES',
@@ -42,6 +46,8 @@ export const mapExportFormat = (format) => {
42
46
  };
43
47
  case 'PROPERTIES_JAVA':
44
48
  return { format: 'PROPERTIES', messageFormat: 'JAVA_STRING_FORMAT' };
49
+ case 'RESX_ICU':
50
+ return { format: 'RESX_ICU', messageFormat: 'ICU' };
45
51
  case 'XLIFF_ICU':
46
52
  return { format: 'XLIFF', messageFormat: 'ICU' };
47
53
  case 'XLIFF_JAVA':
@@ -66,6 +72,14 @@ export const mapExportFormat = (format) => {
66
72
  return { format: 'CSV', messageFormat: 'PHP_SPRINTF' };
67
73
  case 'CSV_RUBY':
68
74
  return { format: 'CSV', messageFormat: 'RUBY_SPRINTF' };
75
+ case 'XLSX_ICU':
76
+ return { format: 'XLSX', messageFormat: 'ICU' };
77
+ case 'XLSX_JAVA':
78
+ return { format: 'XLSX', messageFormat: 'JAVA_STRING_FORMAT' };
79
+ case 'XLSX_PHP':
80
+ return { format: 'XLSX', messageFormat: 'PHP_SPRINTF' };
81
+ case 'XLSX_RUBY':
82
+ return { format: 'XLSX', messageFormat: 'RUBY_SPRINTF' };
69
83
  case undefined:
70
84
  return { format: 'JSON_TOLGEE', messageFormat: 'ICU' };
71
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolgee/cli",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "type": "module",
5
5
  "description": "A tool to interact with the Tolgee Platform through CLI",
6
6
  "repository": {
package/schema.json CHANGED
@@ -74,6 +74,10 @@
74
74
  "items": {
75
75
  "type": "string"
76
76
  }
77
+ },
78
+ "removeOtherKeys": {
79
+ "description": "Remove keys which are not present in the import.",
80
+ "type": "boolean"
77
81
  }
78
82
  }
79
83
  },
@@ -136,6 +140,78 @@
136
140
  "type": ["string", "null"]
137
141
  }
138
142
  }
143
+ },
144
+ "sync": {
145
+ "type": "object",
146
+ "properties": {
147
+ "backup": {
148
+ "description": "Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.",
149
+ "type": "string"
150
+ },
151
+ "continueOnWarning": {
152
+ "description": "Continue the sync regardless of whether warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.",
153
+ "type": "boolean"
154
+ },
155
+ "removeUnused": {
156
+ "description": "Delete unused keys from the Tolgee project",
157
+ "type": "boolean"
158
+ }
159
+ }
160
+ },
161
+ "tag": {
162
+ "type": "object",
163
+ "properties": {
164
+ "filterExtracted": {
165
+ "description": "Extract keys from code and filter by it.",
166
+ "type": "boolean"
167
+ },
168
+ "filterNotExtracted": {
169
+ "description": "Extract keys from code and filter them out.",
170
+ "type": "boolean"
171
+ },
172
+ "filterTag": {
173
+ "description": "Filter only keys with tag. Use * as a wildcard.",
174
+ "type": "array",
175
+ "items": {
176
+ "type": "string"
177
+ }
178
+ },
179
+ "filterNoTag": {
180
+ "description": "Filter only keys without tag. Use * as a wildcard.",
181
+ "type": "array",
182
+ "items": {
183
+ "type": "string"
184
+ }
185
+ },
186
+ "tag": {
187
+ "description": "Add tag to filtered keys.",
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ }
192
+ },
193
+ "tagOther": {
194
+ "description": "Tag keys which are not filtered.",
195
+ "type": "array",
196
+ "items": {
197
+ "type": "string"
198
+ }
199
+ },
200
+ "untag": {
201
+ "description": "Remove tag from filtered keys. Use * as a wildcard.",
202
+ "type": "array",
203
+ "items": {
204
+ "type": "string"
205
+ }
206
+ },
207
+ "untagOther": {
208
+ "description": "Remove tag from keys which are not filtered. Use * as a wildcard.",
209
+ "type": "array",
210
+ "items": {
211
+ "type": "string"
212
+ }
213
+ }
214
+ }
139
215
  }
140
216
  },
141
217
  "$defs": {
@@ -172,11 +248,13 @@
172
248
  "PO_JAVA",
173
249
  "PO_ICU",
174
250
  "PO_RUBY",
251
+ "PO_PYTHON",
175
252
  "APPLE_STRINGS",
176
253
  "APPLE_XLIFF",
177
254
  "PROPERTIES_ICU",
178
255
  "PROPERTIES_JAVA",
179
256
  "ANDROID_XML",
257
+ "COMPOSE_XML",
180
258
  "FLUTTER_ARB",
181
259
  "CSV_ICU",
182
260
  "CSV_JAVA",
@@ -189,7 +267,12 @@
189
267
  "XLIFF_ICU",
190
268
  "XLIFF_JAVA",
191
269
  "XLIFF_PHP",
192
- "XLIFF_RUBY"
270
+ "XLIFF_RUBY",
271
+ "RESX_ICU",
272
+ "XLSX_ICU",
273
+ "XLSX_JAVA",
274
+ "XLSX_PHP",
275
+ "XLSX_RUBY"
193
276
  ]
194
277
  }
195
278
  }