@quaso-i18n/cli 1.0.0-rc.2 → 1.0.0-rc.2.main.g34a775a

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/quaso.mjs +59 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quaso-i18n/cli",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.2.main.g34a775a",
4
4
  "description": "The command line of Quaso, localization for i18next JSON files: upload, download, status and import, from a laptop, from CI and for AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/quaso.mjs CHANGED
@@ -1323,6 +1323,7 @@ var ImportRequest = s.object({
1323
1323
  ]),
1324
1324
  overwrite: s.boolean().optional().describe("Also replace blue (proofread) translations"),
1325
1325
  keepIdentical: s.boolean().optional().describe("Keep values identical to the English"),
1326
+ allowQaErrors: s.boolean().optional().describe("Import values that fail the quality checks, flagged, instead of refusing them"),
1326
1327
  dryRun: s.boolean().optional()
1327
1328
  });
1328
1329
  var JobScope = s.object({
@@ -1332,6 +1333,7 @@ var JobScope = s.object({
1332
1333
  maxItems: 5e3
1333
1334
  }).optional().describe("Only these strings"),
1334
1335
  retranslate: s.boolean().optional().describe("Also re-translate green strings (never blue ones, LLM-4)"),
1336
+ qa: s.boolean().optional().describe("Also re-translate the green translations that fail the quality checks"),
1335
1337
  outdated: s.boolean().optional().describe("Update outdated green translations and propose updates for outdated blue ones (default true)"),
1336
1338
  instruction: s.string({
1337
1339
  maxLength: 4e3
@@ -1602,7 +1604,31 @@ var ProjectSettings = s.object({
1602
1604
  suffix: s.string({
1603
1605
  minLength: 1,
1604
1606
  maxLength: 10
1605
- })
1607
+ }),
1608
+ extra: s.array(s.object({
1609
+ prefix: s.string({
1610
+ minLength: 1,
1611
+ maxLength: 10
1612
+ }),
1613
+ suffix: s.string({
1614
+ minLength: 1,
1615
+ maxLength: 10
1616
+ })
1617
+ }), {
1618
+ maxItems: 10
1619
+ }).optional().describe("Delimiters of placeholders the app fills in itself, such as { and } for {name}"),
1620
+ optional: s.array(s.object({
1621
+ placeholder: s.string({
1622
+ minLength: 1,
1623
+ maxLength: 100
1624
+ }),
1625
+ languages: s.array(LanguageTag, {
1626
+ minItems: 1,
1627
+ maxItems: 200
1628
+ })
1629
+ }), {
1630
+ maxItems: 50
1631
+ }).optional().describe("Placeholders some languages may leave out, such as {article}")
1606
1632
  }),
1607
1633
  logoUrl: s.string({
1608
1634
  maxLength: 2e3
@@ -1767,7 +1793,7 @@ var ReviewLanguageRequestRequest = s.object({
1767
1793
  // package.json
1768
1794
  var package_default = {
1769
1795
  name: "quaso-workspace",
1770
- version: "1.0.0-rc.2",
1796
+ version: "1.0.0-rc.2.main.g34a775a",
1771
1797
  private: true,
1772
1798
  type: "module",
1773
1799
  license: "MIT",
@@ -8006,6 +8032,11 @@ var importCommand = {
8006
8032
  type: "boolean",
8007
8033
  description: "Keep values identical to the English instead of skipping them"
8008
8034
  },
8035
+ {
8036
+ name: "allow-qa-errors",
8037
+ type: "boolean",
8038
+ description: "Import values that fail the quality checks, with their QA errors, instead of refusing them"
8039
+ },
8009
8040
  {
8010
8041
  name: "dry-run",
8011
8042
  type: "boolean",
@@ -8062,6 +8093,7 @@ var importCommand = {
8062
8093
  languages: [],
8063
8094
  withoutFiles: [],
8064
8095
  refused: [],
8096
+ flagged: [],
8065
8097
  unknownKeys: [],
8066
8098
  invalid: [],
8067
8099
  failed: []
@@ -8108,6 +8140,7 @@ var importCommand = {
8108
8140
  };
8109
8141
  if (flag(ctx.args, "overwrite")) request.overwrite = true;
8110
8142
  if (flag(ctx.args, "keep-identical")) request.keepIdentical = true;
8143
+ if (flag(ctx.args, "allow-qa-errors")) request.allowQaErrors = true;
8111
8144
  if (dryRun) request.dryRun = true;
8112
8145
  let result;
8113
8146
  try {
@@ -8149,6 +8182,17 @@ var importCommand = {
8149
8182
  });
8150
8183
  }
8151
8184
  }
8185
+ for (const flagged of result.flagged ?? []) {
8186
+ for (const check of errorChecks(flagged.checks)) {
8187
+ summary.flagged.push({
8188
+ file: pathOf(flagged.file),
8189
+ key: flagged.key,
8190
+ language: flagged.language,
8191
+ check: check.check,
8192
+ message: checkMessage(check)
8193
+ });
8194
+ }
8195
+ }
8152
8196
  for (const unknown of result.unknownKeys) {
8153
8197
  summary.unknownKeys.push({
8154
8198
  file: pathOf(unknown.file),
@@ -8220,8 +8264,14 @@ function renderImport(out, summary) {
8220
8264
  if (result.skippedIdentical > 0) {
8221
8265
  parts.push(`${result.skippedIdentical} identical to the English (skipped)`);
8222
8266
  }
8267
+ if (result.skippedEmpty > 0) parts.push(`${result.skippedEmpty} empty (skipped)`);
8268
+ if (result.droppedForms > 0) {
8269
+ parts.push(`${result.droppedForms} unused plural forms dropped`);
8270
+ }
8223
8271
  if (result.skippedBlue > 0) parts.push(`${result.skippedBlue} proofread kept`);
8224
8272
  if (result.refused.length > 0) parts.push(red(`${result.refused.length} refused`));
8273
+ const flagged = result.flagged ?? [];
8274
+ if (flagged.length > 0) parts.push(yellow(`${flagged.length} with QA errors`));
8225
8275
  if (result.unknownKeys.length > 0) parts.push(`${result.unknownKeys.length} unknown keys`);
8226
8276
  out.print(`${bold(result.language.padEnd(6))} ${parts.join(", ")}`);
8227
8277
  for (const file of result.unknownFiles) {
@@ -8246,6 +8296,7 @@ function renderImport(out, summary) {
8246
8296
  out.print(dim("The other languages were imported; import these again with --language."));
8247
8297
  }
8248
8298
  section("Refused by the quality checks", summary.refused);
8299
+ section("Imported with QA errors (fix them on the instance)", summary.flagged);
8249
8300
  section("Keys the English doesn't have", summary.unknownKeys);
8250
8301
  section("Files that can't be read (fix them and import again)", summary.invalid);
8251
8302
  if (summary.refused.length > 0 && !summary.dryRun) {
@@ -8279,6 +8330,11 @@ var translate = {
8279
8330
  type: "boolean",
8280
8331
  description: "Also translate green (not proofread) strings again; blue ones never change"
8281
8332
  },
8333
+ {
8334
+ name: "qa",
8335
+ type: "boolean",
8336
+ description: "Also translate again the green strings that fail the quality checks, such as imported ones"
8337
+ },
8282
8338
  {
8283
8339
  name: "instruction",
8284
8340
  type: "string",
@@ -8341,6 +8397,7 @@ var translate = {
8341
8397
  };
8342
8398
  if (files) request.files = files;
8343
8399
  if (flag(ctx.args, "retranslate")) request.retranslate = true;
8400
+ if (flag(ctx.args, "qa")) request.qa = true;
8344
8401
  const instruction = option(ctx.args, "instruction");
8345
8402
  if (instruction !== void 0 && instruction.trim() !== "") request.instruction = instruction;
8346
8403
  const model = option(ctx.args, "model");