@worldware/msg-cli 0.4.0 → 0.4.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 +2 -2
- package/dist/{chunk-77PP26JZ.mjs → chunk-LPZ6YNLY.mjs} +1 -1
- package/dist/{chunk-JQKAEOL7.mjs → chunk-PO2Z7EWJ.mjs} +1 -1
- package/dist/{chunk-5VZRQBSH.mjs → chunk-QUPCXFIR.mjs} +1 -1
- package/dist/{chunk-KZ47S4SH.mjs → chunk-XMMVPJHX.mjs} +1 -1
- package/dist/commands/create/project.mjs +2 -2
- package/dist/commands/create/resource.cjs +1 -1
- package/dist/commands/create/resource.mjs +1 -1
- package/dist/commands/export.mjs +2 -2
- package/dist/commands/import.mjs +2 -2
- package/dist/lib/create-project-helpers.mjs +2 -2
- package/dist/lib/create-resource-helpers.cjs +1 -1
- package/dist/lib/create-resource-helpers.d.mts +1 -1
- package/dist/lib/create-resource-helpers.d.ts +1 -1
- package/dist/lib/create-resource-helpers.mjs +1 -1
- package/dist/lib/export-helpers.mjs +2 -2
- package/dist/lib/import-helpers.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ msg create resource myProject messages --edit
|
|
|
156
156
|
|
|
157
157
|
- Writes the file to `i18n/resources/<title>.msg.js` (always `.js`, including TypeScript projects).
|
|
158
158
|
- Uses ES module or CommonJS syntax based on `package.json` `"type"` or presence of `tsconfig.json`.
|
|
159
|
-
- Imports the project via the `#i18n/projects/<projectName
|
|
159
|
+
- Imports the project via the `#i18n/projects/<projectName>.js` alias (added by `msg init`).
|
|
160
160
|
- Sets `lang` from the project's `sourceLocale` and `dir` to `rtl` for Arabic/Hebrew, `ltr` otherwise.
|
|
161
161
|
- Exports a named `resource` plus an async `getMessages()` helper that returns `resource.getTranslation(getLang())`, so the resource can be pre-translated for the runtime locale.
|
|
162
162
|
- Includes sample messages added via chainable `.add()`. Validates that the generated file is importable.
|
|
@@ -166,7 +166,7 @@ msg create resource myProject messages --edit
|
|
|
166
166
|
|
|
167
167
|
```javascript
|
|
168
168
|
import { MsgResource, getLang } from '@worldware/msg';
|
|
169
|
-
import project from '#i18n/projects/myProject';
|
|
169
|
+
import project from '#i18n/projects/myProject.js';
|
|
170
170
|
|
|
171
171
|
export const resource = MsgResource.create({ /* title, attributes, notes */ }, project);
|
|
172
172
|
|
|
@@ -80,7 +80,7 @@ function generateMsgResourceContent(params) {
|
|
|
80
80
|
const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
|
|
81
81
|
const dirStr = `'${dir}'`;
|
|
82
82
|
const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
|
|
83
|
-
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
|
|
83
|
+
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
|
|
84
84
|
const createAndAdd = `MsgResource.create({
|
|
85
85
|
title: ${titleStr},
|
|
86
86
|
attributes: {
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
importMsgProjectFile,
|
|
4
4
|
loadPackageJsonForCreateProject,
|
|
5
5
|
writeMsgProjectFile
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-QUPCXFIR.mjs";
|
|
7
|
+
import "../../chunk-PO2Z7EWJ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
findPackageJsonPath
|
|
10
10
|
} from "../../chunk-F7XZRKP7.mjs";
|
|
@@ -181,7 +181,7 @@ function generateMsgResourceContent(params) {
|
|
|
181
181
|
const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
|
|
182
182
|
const dirStr = `'${dir}'`;
|
|
183
183
|
const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
|
|
184
|
-
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
|
|
184
|
+
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
|
|
185
185
|
const createAndAdd = `MsgResource.create({
|
|
186
186
|
title: ${titleStr},
|
|
187
187
|
attributes: {
|
package/dist/commands/export.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
importMsgResourcesFromPaths,
|
|
6
6
|
serializeResourceGroupsToXliff,
|
|
7
7
|
writeXliffFiles
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-XMMVPJHX.mjs";
|
|
9
9
|
import "../chunk-Q775ZGC5.mjs";
|
|
10
10
|
import "../chunk-XID5J2F7.mjs";
|
|
11
11
|
import "../chunk-MGHC4AYZ.mjs";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-PO2Z7EWJ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
loadPackageJsonForMsg
|
|
15
15
|
} from "../chunk-F7XZRKP7.mjs";
|
package/dist/commands/import.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
parseXliffFilename,
|
|
6
6
|
processXliffFile,
|
|
7
7
|
writeTranslationFiles
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-LPZ6YNLY.mjs";
|
|
9
9
|
import "../chunk-Q775ZGC5.mjs";
|
|
10
10
|
import "../chunk-XID5J2F7.mjs";
|
|
11
11
|
import "../chunk-MGHC4AYZ.mjs";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-PO2Z7EWJ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
loadPackageJsonForMsg
|
|
15
15
|
} from "../chunk-F7XZRKP7.mjs";
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
importMsgProjectFile,
|
|
4
4
|
loadPackageJsonForCreateProject,
|
|
5
5
|
writeMsgProjectFile
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-QUPCXFIR.mjs";
|
|
7
|
+
import "../chunk-PO2Z7EWJ.mjs";
|
|
8
8
|
import "../chunk-F7XZRKP7.mjs";
|
|
9
9
|
export {
|
|
10
10
|
calculateRelativePath,
|
|
@@ -169,7 +169,7 @@ function generateMsgResourceContent(params) {
|
|
|
169
169
|
const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
|
|
170
170
|
const dirStr = `'${dir}'`;
|
|
171
171
|
const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
|
|
172
|
-
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
|
|
172
|
+
const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
|
|
173
173
|
const createAndAdd = `MsgResource.create({
|
|
174
174
|
title: ${titleStr},
|
|
175
175
|
attributes: {
|
|
@@ -38,7 +38,7 @@ declare function importMsgProjectForResource(projectsDir: string, projectName: s
|
|
|
38
38
|
* Emits ESM or CJS boilerplate that creates a MsgResource, adds sample
|
|
39
39
|
* messages via chainable `.add()`, and exports `resource` plus an async
|
|
40
40
|
* `getMessages` loader that calls `resource.getTranslation(getLang())`.
|
|
41
|
-
* Project import uses the `#i18n/projects/<name
|
|
41
|
+
* Project import uses the `#i18n/projects/<name>.js` alias from `msg init`.
|
|
42
42
|
* @param params - Title, projectName, sourceLocale, dir, and isEsm
|
|
43
43
|
* @returns The generated file content
|
|
44
44
|
*/
|
|
@@ -38,7 +38,7 @@ declare function importMsgProjectForResource(projectsDir: string, projectName: s
|
|
|
38
38
|
* Emits ESM or CJS boilerplate that creates a MsgResource, adds sample
|
|
39
39
|
* messages via chainable `.add()`, and exports `resource` plus an async
|
|
40
40
|
* `getMessages` loader that calls `resource.getTranslation(getLang())`.
|
|
41
|
-
* Project import uses the `#i18n/projects/<name
|
|
41
|
+
* Project import uses the `#i18n/projects/<name>.js` alias from `msg init`.
|
|
42
42
|
* @param params - Title, projectName, sourceLocale, dir, and isEsm
|
|
43
43
|
* @returns The generated file content
|
|
44
44
|
*/
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
importMsgResourcesFromPaths,
|
|
6
6
|
serializeResourceGroupsToXliff,
|
|
7
7
|
writeXliffFiles
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-XMMVPJHX.mjs";
|
|
9
9
|
import "../chunk-Q775ZGC5.mjs";
|
|
10
10
|
import "../chunk-XID5J2F7.mjs";
|
|
11
11
|
import "../chunk-MGHC4AYZ.mjs";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-PO2Z7EWJ.mjs";
|
|
13
13
|
import "../chunk-F7XZRKP7.mjs";
|
|
14
14
|
export {
|
|
15
15
|
filterResourceGroupsByProject,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
parseXliffFilename,
|
|
9
9
|
processXliffFile,
|
|
10
10
|
writeTranslationFiles
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-LPZ6YNLY.mjs";
|
|
12
12
|
import "../chunk-Q775ZGC5.mjs";
|
|
13
13
|
import "../chunk-XID5J2F7.mjs";
|
|
14
14
|
import "../chunk-MGHC4AYZ.mjs";
|
|
15
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-PO2Z7EWJ.mjs";
|
|
16
16
|
import "../chunk-F7XZRKP7.mjs";
|
|
17
17
|
export {
|
|
18
18
|
extractResourceFromXliffFile,
|