@worldware/msg-cli 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -232,9 +232,9 @@ msg export -p myApp
232
232
 
233
233
  - **Message keys** — Stored as unit `id` (sanitized for XML) and `name` (original key).
234
234
  - **Resource notes** — Emitted as file-level `<notes>` with category (e.g. `description`, `comment`).
235
- - **Resource attributes** — `dir` → file `srcDir`; `dnt` → file `translate="no"`.
235
+ - **Resource attributes** — `dir` → file `srcDir` when it is not the default `"auto"`; `dnt` → file `translate="no"`.
236
236
  - **Message notes** — Emitted as unit-level `<notes>` with category (e.g. `description`, `context`, `parameters`).
237
- - **Message attributes** — `dnt` → unit `translate="no"`; message `dir` is serialized as the unit’s `srcDir` attribute (XLIFF text direction for the segment).
237
+ - **Message attributes** — `dnt` → unit `translate="no"`; message `dir` is serialized as the unit’s `srcDir` unless it is `"auto"`.
238
238
  - **Message format** — Resolved `format` (`NONE` / `MF1` / `MF2`, including inheritance from resource/project) is written as the unit `type` attribute using the XLIFF custom form `msg:NONE`, `msg:MF1`, or `msg:MF2`.
239
239
 
240
240
  **Plural, gender, select (PGS):** Classifiable plural/select messages are exported to the [XLIFF 2.2 Plural, Gender, and Select module](https://docs.oasis-open.org/xliff/xliff-core/v2.2/xliff-extended-v2.2-part2.html) (`xmlns:pgs="urn:oasis:names:tc:xliff:pgs:1.0"`): `pgs:switch` on the `<unit>`, and one `<segment>` per variant with `pgs:case`.
@@ -354,14 +354,14 @@ msg import
354
354
  # or: msg import --project myApp --language fr
355
355
  ```
356
356
 
357
- **5. Resulting French translation file** — `l10n/translations/myApp/fr/messages.json` (notes omitted; `attributes.dir` is empty unless the XLIFF `<file>` carries `trgDir`):
357
+ **5. Resulting French translation file** — `l10n/translations/myApp/fr/messages.json` (notes omitted; `attributes.dir` is `"auto"` unless the XLIFF `<file>` carries `trgDir`):
358
358
 
359
359
  ```json
360
360
  {
361
361
  "title": "messages",
362
362
  "attributes": {
363
363
  "lang": "fr",
364
- "dir": "",
364
+ "dir": "auto",
365
365
  "dnt": false
366
366
  },
367
367
  "messages": [
@@ -245,7 +245,7 @@ function extractResourceFromXliffFile(fileEl, xliffTrgLang, project, targetLocal
245
245
  const dnt = translate === "no" || translate === "false";
246
246
  const attributes = {
247
247
  lang: trgLang,
248
- dir: trgDir ?? "",
248
+ dir: trgDir ?? "auto",
249
249
  dnt
250
250
  };
251
251
  const notes = [];
@@ -144,7 +144,7 @@ function resourceGroupToXliff22(group) {
144
144
  `id="${fileId}"`,
145
145
  `original="${escapeXml(orig)}"`
146
146
  ];
147
- if (attrs.dir) {
147
+ if (attrs.dir && attrs.dir !== "auto") {
148
148
  fileAttrs.push(`srcDir="${escapeXml(attrs.dir)}"`);
149
149
  }
150
150
  if (attrs.dnt === true) {
@@ -167,7 +167,7 @@ function resourceGroupToXliff22(group) {
167
167
  if (msgAttr?.dnt === true) {
168
168
  msgAttrs.push('translate="no"');
169
169
  }
170
- if (msgAttr?.dir) {
170
+ if (msgAttr?.dir && msgAttr.dir !== "auto") {
171
171
  msgAttrs.push(`srcDir="${escapeXml(msgAttr.dir)}"`);
172
172
  }
173
173
  const msgFormat = resolveMessageFormat(
@@ -273,7 +273,7 @@ var CreateProject = class _CreateProject extends import_core.Command {
273
273
  }
274
274
  const format = resolveCreateProjectFormat(flags.format, baseProject);
275
275
  const loaderPathLine = "const path = `${TRANSLATION_IMPORT_PATH}/${project}/${language}/${title}.json`;";
276
- const loaderWarnLine = "console.warn(`Translations for locale ${language} could not be loaded.`, error);";
276
+ const loaderWarnLine = "console.warn(`Translations for locale ${language} could not be loaded.`);";
277
277
  const loaderBody = `${loaderPathLine}
278
278
  try {
279
279
  const module = await import(path, { with: { type: 'json' } });
@@ -282,7 +282,7 @@ var CreateProject = class _CreateProject extends import_core.Command {
282
282
  ${loaderWarnLine}
283
283
  return {
284
284
  title,
285
- attributes: { lang: language, dir: '' },
285
+ attributes: { lang: language, dir: 'auto' },
286
286
  notes: [],
287
287
  messages: []
288
288
  };
@@ -123,7 +123,7 @@ var CreateProject = class _CreateProject extends Command {
123
123
  }
124
124
  const format = resolveCreateProjectFormat(flags.format, baseProject);
125
125
  const loaderPathLine = "const path = `${TRANSLATION_IMPORT_PATH}/${project}/${language}/${title}.json`;";
126
- const loaderWarnLine = "console.warn(`Translations for locale ${language} could not be loaded.`, error);";
126
+ const loaderWarnLine = "console.warn(`Translations for locale ${language} could not be loaded.`);";
127
127
  const loaderBody = `${loaderPathLine}
128
128
  try {
129
129
  const module = await import(path, { with: { type: 'json' } });
@@ -132,7 +132,7 @@ var CreateProject = class _CreateProject extends Command {
132
132
  ${loaderWarnLine}
133
133
  return {
134
134
  title,
135
- attributes: { lang: language, dir: '' },
135
+ attributes: { lang: language, dir: 'auto' },
136
136
  notes: [],
137
137
  messages: []
138
138
  };
@@ -470,7 +470,7 @@ function resourceGroupToXliff22(group) {
470
470
  `id="${fileId}"`,
471
471
  `original="${escapeXml(orig)}"`
472
472
  ];
473
- if (attrs.dir) {
473
+ if (attrs.dir && attrs.dir !== "auto") {
474
474
  fileAttrs.push(`srcDir="${escapeXml(attrs.dir)}"`);
475
475
  }
476
476
  if (attrs.dnt === true) {
@@ -493,7 +493,7 @@ function resourceGroupToXliff22(group) {
493
493
  if (msgAttr?.dnt === true) {
494
494
  msgAttrs.push('translate="no"');
495
495
  }
496
- if (msgAttr?.dir) {
496
+ if (msgAttr?.dir && msgAttr.dir !== "auto") {
497
497
  msgAttrs.push(`srcDir="${escapeXml(msgAttr.dir)}"`);
498
498
  }
499
499
  const msgFormat = resolveMessageFormat(
@@ -5,7 +5,7 @@ import {
5
5
  importMsgResourcesFromPaths,
6
6
  serializeResourceGroupsToXliff,
7
7
  writeXliffFiles
8
- } from "../chunk-XMMVPJHX.mjs";
8
+ } from "../chunk-PYIBLOWY.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
@@ -602,7 +602,7 @@ function extractResourceFromXliffFile(fileEl, xliffTrgLang, project, targetLocal
602
602
  const dnt = translate === "no" || translate === "false";
603
603
  const attributes = {
604
604
  lang: trgLang,
605
- dir: trgDir ?? "",
605
+ dir: trgDir ?? "auto",
606
606
  dnt
607
607
  };
608
608
  const notes = [];
@@ -5,7 +5,7 @@ import {
5
5
  parseXliffFilename,
6
6
  processXliffFile,
7
7
  writeTranslationFiles
8
- } from "../chunk-LPZ6YNLY.mjs";
8
+ } from "../chunk-MPDE5BUV.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
@@ -407,7 +407,7 @@ function resourceGroupToXliff22(group) {
407
407
  `id="${fileId}"`,
408
408
  `original="${escapeXml(orig)}"`
409
409
  ];
410
- if (attrs.dir) {
410
+ if (attrs.dir && attrs.dir !== "auto") {
411
411
  fileAttrs.push(`srcDir="${escapeXml(attrs.dir)}"`);
412
412
  }
413
413
  if (attrs.dnt === true) {
@@ -430,7 +430,7 @@ function resourceGroupToXliff22(group) {
430
430
  if (msgAttr?.dnt === true) {
431
431
  msgAttrs.push('translate="no"');
432
432
  }
433
- if (msgAttr?.dir) {
433
+ if (msgAttr?.dir && msgAttr.dir !== "auto") {
434
434
  msgAttrs.push(`srcDir="${escapeXml(msgAttr.dir)}"`);
435
435
  }
436
436
  const msgFormat = resolveMessageFormat(
@@ -5,7 +5,7 @@ import {
5
5
  importMsgResourcesFromPaths,
6
6
  serializeResourceGroupsToXliff,
7
7
  writeXliffFiles
8
- } from "../chunk-XMMVPJHX.mjs";
8
+ } from "../chunk-PYIBLOWY.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
@@ -542,7 +542,7 @@ function extractResourceFromXliffFile(fileEl, xliffTrgLang, project, targetLocal
542
542
  const dnt = translate === "no" || translate === "false";
543
543
  const attributes = {
544
544
  lang: trgLang,
545
- dir: trgDir ?? "",
545
+ dir: trgDir ?? "auto",
546
546
  dnt
547
547
  };
548
548
  const notes = [];
@@ -8,7 +8,7 @@ import {
8
8
  parseXliffFilename,
9
9
  processXliffFile,
10
10
  writeTranslationFiles
11
- } from "../chunk-LPZ6YNLY.mjs";
11
+ } from "../chunk-MPDE5BUV.mjs";
12
12
  import "../chunk-Q775ZGC5.mjs";
13
13
  import "../chunk-XID5J2F7.mjs";
14
14
  import "../chunk-MGHC4AYZ.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldware/msg-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "CLI for msg library",
5
5
  "main": "dist/commands/init.cjs",
6
6
  "module": "dist/commands/init.mjs",
@@ -39,14 +39,14 @@
39
39
  "@messageformat/icu-messageformat-1": "^0.12.0",
40
40
  "@messageformat/parser": "^5.1.1",
41
41
  "@oclif/core": "^3.21.2",
42
- "@worldware/msg": "^0.10.0",
42
+ "@worldware/msg": "^0.12.0",
43
43
  "fast-xml-parser": "^5.3.4",
44
44
  "messageformat": "^4.0.0-10"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^22.0.0",
48
48
  "@vitest/coverage-v8": "^4.0.18",
49
- "semantic-release": "^25.0.8",
49
+ "semantic-release": "^25.0.9",
50
50
  "ts-node": "^10.9.2",
51
51
  "tsup": "^8.5.1",
52
52
  "typedoc": "^0.28.20",