@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 +4 -4
- package/dist/{chunk-LPZ6YNLY.mjs → chunk-MPDE5BUV.mjs} +1 -1
- package/dist/{chunk-XMMVPJHX.mjs → chunk-PYIBLOWY.mjs} +2 -2
- package/dist/commands/create/project.cjs +2 -2
- package/dist/commands/create/project.mjs +2 -2
- package/dist/commands/export.cjs +2 -2
- package/dist/commands/export.mjs +1 -1
- package/dist/commands/import.cjs +1 -1
- package/dist/commands/import.mjs +1 -1
- package/dist/lib/export-helpers.cjs +2 -2
- package/dist/lib/export-helpers.mjs +1 -1
- package/dist/lib/import-helpers.cjs +1 -1
- package/dist/lib/import-helpers.mjs +1 -1
- package/package.json +3 -3
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`
|
|
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
|
|
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
|
|
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
|
|
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
|
};
|
package/dist/commands/export.cjs
CHANGED
|
@@ -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(
|
package/dist/commands/export.mjs
CHANGED
package/dist/commands/import.cjs
CHANGED
|
@@ -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 = [];
|
package/dist/commands/import.mjs
CHANGED
|
@@ -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(
|
|
@@ -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 = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worldware/msg-cli",
|
|
3
|
-
"version": "0.5.
|
|
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.
|
|
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.
|
|
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",
|