@esgettext/tools 1.3.1 → 1.3.2
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 -5
- package/dist/commands/init.js +15 -10
- package/dist/commands/install.js +1 -1
- package/dist/commands/msgfmt-all.js +5 -3
- package/dist/commands/msgmerge-all.js +5 -3
- package/dist/commands/xgettext.js +16 -16
- package/dist/configuration.js +10 -2
- package/dist/index.js +36 -4
- package/dist/optspec.js +1 -1
- package/dist/package.js +1 -1
- package/dist/pot/entry.js +8 -4
- package/package.json +18 -5
package/README.md
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Supporting tools for https://github.com/gflohr/esgettext.
|
|
4
4
|
|
|
5
|
+
The package also contains code for parsing po files and for writing them.
|
|
6
|
+
|
|
5
7
|
## Table of Contents <!-- omit in toc -->
|
|
6
8
|
|
|
7
|
-
- [Status](#status)
|
|
8
9
|
- [Prerequisites](#prerequisites)
|
|
9
10
|
- [Un\*x/Linux](#unxlinux)
|
|
10
11
|
- [Mac OS X](#mac-os-x)
|
|
@@ -39,10 +40,6 @@ Supporting tools for https://github.com/gflohr/esgettext.
|
|
|
39
40
|
- [`programs.msgfmt.options`](#programsmsgfmtoptions)
|
|
40
41
|
- [Copyright](#copyright)
|
|
41
42
|
|
|
42
|
-
## Status
|
|
43
|
-
|
|
44
|
-
in development.
|
|
45
|
-
|
|
46
43
|
## Prerequisites
|
|
47
44
|
|
|
48
45
|
Most of the esgettext tools depend at least indirectly on the GNU gettext
|
package/dist/commands/init.js
CHANGED
|
@@ -257,7 +257,7 @@ class Init {
|
|
|
257
257
|
}
|
|
258
258
|
const dependencies = Object.assign(Object.assign({}, pkg.content.dependencies), { '@esgettext/runtime': `^${package_1.Package.getVersion()}` });
|
|
259
259
|
if (this.options.verbose) {
|
|
260
|
-
console.log(gtx._x("Adding package '{package}' version {version} as a development
|
|
260
|
+
console.log(gtx._x("Adding package '{package}' version {version} as a development dependency.", { package: '@esgettext/tools', version: `^${package_1.Package.getVersion()}` }));
|
|
261
261
|
}
|
|
262
262
|
const devDependencies = Object.assign(Object.assign({}, pkg.content.devDependencies), { '@esgettext/tools': `^${package_1.Package.getVersion()}` });
|
|
263
263
|
if (!((_a = pkg.content.devDependencies) === null || _a === void 0 ? void 0 : _a['npm-run-all']) &&
|
|
@@ -312,8 +312,11 @@ class Init {
|
|
|
312
312
|
command: 'npm run esgettext:update-po',
|
|
313
313
|
filename: `${setup.poDirectory}/${setup.textdomain}.pot`,
|
|
314
314
|
}));
|
|
315
|
-
console.log(gtx._x("3) Create a translation file with '{command}' (replace
|
|
315
|
+
console.log(gtx._x("3) Create a translation file with '{command}' (replace" +
|
|
316
|
+
" 'xy' with a language code like 'de' or 'pt_BR'). Get" +
|
|
317
|
+
" more information with '{command2}'", {
|
|
316
318
|
command: `msginit -l xy -i ${setup.poDirectory}/${setup.textdomain}.pot -o po/xy.po`,
|
|
319
|
+
command2: 'npm run esgettext:add-language',
|
|
317
320
|
}));
|
|
318
321
|
console.log(gtx._x('4) Translate the message with a PO editor of your choice.', {
|
|
319
322
|
command: `msginit -l xy -i ${setup.poDirectory}/${setup.textdomain}.pot -o po/xy.po`,
|
|
@@ -390,7 +393,7 @@ class Init {
|
|
|
390
393
|
const parts = candidate.split('/');
|
|
391
394
|
if (!hasTestDir && parts[0].match(/^tests?$/)) {
|
|
392
395
|
if (this.options.verbose) {
|
|
393
|
-
console.log(gtx._x(
|
|
396
|
+
console.log(gtx._x("Looks like you have test files under '{directory}'. We will not translate them.", { directory: parts[0] }));
|
|
394
397
|
}
|
|
395
398
|
exclude.push(`${parts[0]}/*/**`);
|
|
396
399
|
hasTestDir = true;
|
|
@@ -429,8 +432,8 @@ class Init {
|
|
|
429
432
|
options.push(`--exclude="${pattern}"`);
|
|
430
433
|
}
|
|
431
434
|
if (!topLevelDirectories.length) {
|
|
432
|
-
this.error(gtx._x("Warning! Could not find any source files. Will use the pattern './src/**/*.{js,jsx,ts,tsx}
|
|
433
|
-
options.push('"./src/**/*.{js,jsx,ts,tsx}"');
|
|
435
|
+
this.error(gtx._x("Warning! Could not find any source files. Will use the pattern '{pattern}'.", { pattern: './src/**/*.{js,cjs,mjs,jsx,ts,tsx}' }));
|
|
436
|
+
options.push('"./src/**/*.{js,cjs,mjs,jsx,ts,tsx}"');
|
|
434
437
|
}
|
|
435
438
|
else {
|
|
436
439
|
for (const tld in extenders) {
|
|
@@ -447,7 +450,7 @@ class Init {
|
|
|
447
450
|
}
|
|
448
451
|
}
|
|
449
452
|
if (this.options.verbose) {
|
|
450
|
-
console.log(gtx._x('Command-line options for extracting source files are: {options}', { options: options.join(' ') }));
|
|
453
|
+
console.log(gtx._x('Command-line options for extracting strings from source files are: {options}', { options: options.join(' ') }));
|
|
451
454
|
}
|
|
452
455
|
return options;
|
|
453
456
|
}
|
|
@@ -505,7 +508,7 @@ class Init {
|
|
|
505
508
|
return resolve(true);
|
|
506
509
|
}
|
|
507
510
|
catch (error) {
|
|
508
|
-
return resolve(gtx._x(
|
|
511
|
+
return resolve(gtx._x("The command '{command}' did not work. Error: {error}.", {
|
|
509
512
|
command,
|
|
510
513
|
error,
|
|
511
514
|
}));
|
|
@@ -550,7 +553,7 @@ class Init {
|
|
|
550
553
|
nonEmpty(answer) {
|
|
551
554
|
return new Promise(resolve => {
|
|
552
555
|
if (answer.trim().length === 0) {
|
|
553
|
-
resolve(gtx._('Please enter
|
|
556
|
+
resolve(gtx._('Please enter at least one character!'));
|
|
554
557
|
}
|
|
555
558
|
else {
|
|
556
559
|
resolve(true);
|
|
@@ -584,7 +587,7 @@ class Init {
|
|
|
584
587
|
return new Promise(resolve => {
|
|
585
588
|
const directory = answer.trim();
|
|
586
589
|
if (directory.length === 0) {
|
|
587
|
-
return resolve(gtx._('Please enter
|
|
590
|
+
return resolve(gtx._('Please enter at least one character!'));
|
|
588
591
|
}
|
|
589
592
|
if (!this.options.force) {
|
|
590
593
|
if (fs.existsSync(directory)) {
|
|
@@ -674,7 +677,9 @@ class Init {
|
|
|
674
677
|
validate: answer => this.checkTool(answer),
|
|
675
678
|
}),
|
|
676
679
|
msgfmtOptions: yield (0, prompts_1.input)({
|
|
677
|
-
message: gtx._x("
|
|
680
|
+
message: gtx._x("(Boolean) options to invoke '{tool}' with", {
|
|
681
|
+
tool: 'msgfmt',
|
|
682
|
+
}),
|
|
678
683
|
default: '--check --statistics --verbose',
|
|
679
684
|
}),
|
|
680
685
|
poDirectory: yield (0, prompts_1.input)({
|
package/dist/commands/install.js
CHANGED
|
@@ -79,14 +79,16 @@ class MsgfmtAll {
|
|
|
79
79
|
},
|
|
80
80
|
msgfmt: {
|
|
81
81
|
type: 'string',
|
|
82
|
-
describe: gtx.
|
|
82
|
+
describe: gtx._x("'{program}' program if not in $PATH", {
|
|
83
|
+
program: 'msgfmt',
|
|
84
|
+
}),
|
|
83
85
|
default: (_f = (_e = (_d = this.configuration.programs) === null || _d === void 0 ? void 0 : _d.msgfmt) === null || _e === void 0 ? void 0 : _e.path) !== null && _f !== void 0 ? _f : 'msgfmt',
|
|
84
86
|
group: gtx._('Mode of operation:'),
|
|
85
87
|
},
|
|
86
88
|
options: {
|
|
87
89
|
multi: true,
|
|
88
90
|
type: 'string',
|
|
89
|
-
describe: gtx._x("Options to pass to '{program}' program (without hyphens)", { program: 'msgfmt' }),
|
|
91
|
+
describe: gtx._x("Options to pass to '{program}' program (without leading hyphens)", { program: 'msgfmt' }),
|
|
90
92
|
default: ((_h = (_g = this.configuration.programs) === null || _g === void 0 ? void 0 : _g.msgfmt) === null || _h === void 0 ? void 0 : _h.options) || [
|
|
91
93
|
'check',
|
|
92
94
|
'statistics',
|
|
@@ -151,7 +153,7 @@ class MsgfmtAll {
|
|
|
151
153
|
if (options) {
|
|
152
154
|
options.forEach(name => {
|
|
153
155
|
if (name.substring(0, 1) === '-') {
|
|
154
|
-
console.error(gtx._x("{programName}: option '{option}': Options passed to '{program}' must
|
|
156
|
+
console.error(gtx._x("{programName}: option '{option}': Options passed to '{program}' must be given without leading hyphens", {
|
|
155
157
|
programName: package_1.Package.getName(),
|
|
156
158
|
program: 'msgfmt',
|
|
157
159
|
option: name,
|
|
@@ -89,14 +89,16 @@ class MsgmergeAll {
|
|
|
89
89
|
},
|
|
90
90
|
msgmerge: {
|
|
91
91
|
type: 'string',
|
|
92
|
-
describe: gtx.
|
|
92
|
+
describe: gtx._x("'{program}' program if not in $PATH", {
|
|
93
|
+
program: 'msgmerge',
|
|
94
|
+
}),
|
|
93
95
|
default: (_f = (_e = (_d = this.configuration.programs) === null || _d === void 0 ? void 0 : _d.msgmerge) === null || _e === void 0 ? void 0 : _e.path) !== null && _f !== void 0 ? _f : 'msgmerge',
|
|
94
96
|
group: gtx._('Mode of operation:'),
|
|
95
97
|
},
|
|
96
98
|
options: {
|
|
97
99
|
multi: true,
|
|
98
100
|
type: 'string',
|
|
99
|
-
describe: gtx._x("Options to pass to '{program}' program (without hyphens)", { program: 'msgmerge' }),
|
|
101
|
+
describe: gtx._x("Options to pass to '{program}' program (without leading hyphens)", { program: 'msgmerge' }),
|
|
100
102
|
default: (_h = (_g = this.configuration.programs) === null || _g === void 0 ? void 0 : _g.msgmerge) === null || _h === void 0 ? void 0 : _h.options,
|
|
101
103
|
group: gtx._('Mode of operation:'),
|
|
102
104
|
},
|
|
@@ -163,7 +165,7 @@ class MsgmergeAll {
|
|
|
163
165
|
if (options) {
|
|
164
166
|
options.forEach(name => {
|
|
165
167
|
if (name.substring(0, 1) === '-') {
|
|
166
|
-
console.error(gtx._x("{programName}: option '{option}': Options passed to '{program}' must
|
|
168
|
+
console.error(gtx._x("{programName}: option '{option}': Options passed to '{program}' must be given without leading hyphens", {
|
|
167
169
|
programName: package_1.Package.getName(),
|
|
168
170
|
program: 'msgfmt',
|
|
169
171
|
option: name,
|
|
@@ -89,7 +89,7 @@ class XGettext {
|
|
|
89
89
|
group: gtx._('Output file location:'),
|
|
90
90
|
alias: 'p',
|
|
91
91
|
type: 'string',
|
|
92
|
-
describe: gtx._('output files will be placed in directory
|
|
92
|
+
describe: gtx._('output files will be placed in the specified directory. If output file is -, output is written to standard output.'),
|
|
93
93
|
default: (_d = (_c = this.configuration.po) === null || _c === void 0 ? void 0 : _c.directory) !== null && _d !== void 0 ? _d : '.',
|
|
94
94
|
},
|
|
95
95
|
language: {
|
|
@@ -107,27 +107,27 @@ class XGettext {
|
|
|
107
107
|
default: 'ASCII',
|
|
108
108
|
},
|
|
109
109
|
'join-existing': {
|
|
110
|
-
group: gtx._('
|
|
110
|
+
group: gtx._('Mode of operation:'),
|
|
111
111
|
alias: 'j',
|
|
112
112
|
type: 'boolean',
|
|
113
113
|
describe: gtx._('join messages with existing file'),
|
|
114
114
|
},
|
|
115
115
|
'exclude-file': {
|
|
116
116
|
multi: true,
|
|
117
|
-
group: gtx._('
|
|
117
|
+
group: gtx._('Mode of operation:'),
|
|
118
118
|
alias: 'x',
|
|
119
119
|
type: 'string',
|
|
120
|
-
describe: gtx._('entries from
|
|
120
|
+
describe: gtx._('entries from this po file are not extracted'),
|
|
121
121
|
},
|
|
122
122
|
'add-comments': {
|
|
123
123
|
multi: true,
|
|
124
|
-
group: gtx._('
|
|
124
|
+
group: gtx._('Mode of operation:'),
|
|
125
125
|
alias: 'c',
|
|
126
126
|
type: 'string',
|
|
127
|
-
describe: gtx._('place comment blocks starting with
|
|
127
|
+
describe: gtx._('place comment blocks starting with this string and preceding keyword lines in output file'),
|
|
128
128
|
},
|
|
129
129
|
'add-all-comments': {
|
|
130
|
-
group: gtx._('
|
|
130
|
+
group: gtx._('Mode of operation:'),
|
|
131
131
|
describe: gtx._('place all comment blocks preceding keyword lines in output file'),
|
|
132
132
|
type: 'boolean',
|
|
133
133
|
},
|
|
@@ -141,7 +141,7 @@ class XGettext {
|
|
|
141
141
|
multi: true,
|
|
142
142
|
group: gtx._('Language specific options:'),
|
|
143
143
|
type: 'string',
|
|
144
|
-
describe: gtx._('look for
|
|
144
|
+
describe: gtx._('look for this word as an additional keyword'),
|
|
145
145
|
},
|
|
146
146
|
flag: {
|
|
147
147
|
multi: true,
|
|
@@ -153,7 +153,7 @@ class XGettext {
|
|
|
153
153
|
multi: true,
|
|
154
154
|
group: gtx._('Language specific options:'),
|
|
155
155
|
type: 'string',
|
|
156
|
-
describe: gtx._('only
|
|
156
|
+
describe: gtx._('only search for method calls of specified instance names'),
|
|
157
157
|
},
|
|
158
158
|
'force-po': {
|
|
159
159
|
group: gtx._('Output details:'),
|
|
@@ -177,7 +177,7 @@ class XGettext {
|
|
|
177
177
|
group: gtx._('Output details:'),
|
|
178
178
|
alias: 's',
|
|
179
179
|
type: 'boolean',
|
|
180
|
-
describe: gtx._('generate sorted output'),
|
|
180
|
+
describe: gtx._('generate sorted output (deprecated)'),
|
|
181
181
|
},
|
|
182
182
|
'sort-by-file': {
|
|
183
183
|
group: gtx._('Output details:'),
|
|
@@ -223,13 +223,13 @@ class XGettext {
|
|
|
223
223
|
group: gtx._('Output details:'),
|
|
224
224
|
alias: 'm',
|
|
225
225
|
type: 'string',
|
|
226
|
-
describe: gtx._('use
|
|
226
|
+
describe: gtx._('use this string or "" as prefix for msgstr values'),
|
|
227
227
|
},
|
|
228
228
|
'msgstr-suffix': {
|
|
229
229
|
group: gtx._('Output details:'),
|
|
230
230
|
alias: 'M',
|
|
231
231
|
type: 'string',
|
|
232
|
-
describe: gtx._('use
|
|
232
|
+
describe: gtx._('use this string or "" as suffix for msgstr values'),
|
|
233
233
|
},
|
|
234
234
|
verbose: {
|
|
235
235
|
alias: 'V',
|
|
@@ -303,7 +303,7 @@ class XGettext {
|
|
|
303
303
|
}
|
|
304
304
|
if (this.options.joinExisting) {
|
|
305
305
|
if (this.options.output === '-') {
|
|
306
|
-
console.error(gtx._x(
|
|
306
|
+
console.error(gtx._x("{programName}: Error: '--join-existing'" +
|
|
307
307
|
' cannot be used, when output is written to stdout', {
|
|
308
308
|
programName: this.options.$0,
|
|
309
309
|
}));
|
|
@@ -432,16 +432,16 @@ class XGettext {
|
|
|
432
432
|
default:
|
|
433
433
|
if ('-' === filename) {
|
|
434
434
|
this.warn(gtx._('language for standard input is unknown without' +
|
|
435
|
-
' option "--language"; will try
|
|
435
|
+
' option "--language"; will try TypeScript'));
|
|
436
436
|
}
|
|
437
437
|
else {
|
|
438
438
|
this.warn(gtx._x('file "{filename}" extension "{extname}"' +
|
|
439
|
-
' is unknown; will try
|
|
439
|
+
' is unknown; will try TypeScript instead', {
|
|
440
440
|
filename,
|
|
441
441
|
extname: ext,
|
|
442
442
|
}));
|
|
443
443
|
}
|
|
444
|
-
parser = new
|
|
444
|
+
parser = new typescript_1.TypeScriptParser(this.catalog, parserOptions);
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
447
|
return parser;
|
package/dist/configuration.js
CHANGED
|
@@ -46,8 +46,16 @@ require("@valibot/i18n/de");
|
|
|
46
46
|
const package_1 = require("./package");
|
|
47
47
|
const gtx = runtime_1.Textdomain.getInstance('com.cantanea.esgettext-tools');
|
|
48
48
|
const bugsAddressSchema = v.union([
|
|
49
|
-
v.pipe(v.string(), v.nonEmpty(gtx.
|
|
50
|
-
|
|
49
|
+
v.pipe(v.string(), v.nonEmpty(gtx._x("The field '{field}' must not be empty!", {
|
|
50
|
+
field: 'msgid-bugs-address',
|
|
51
|
+
})), v.email(gtx._x("The field '{field}' must contain a valid email address or URL!", {
|
|
52
|
+
field: 'msgid-bugs-address',
|
|
53
|
+
}))),
|
|
54
|
+
v.pipe(v.string(), v.nonEmpty(gtx._x("The field '{field}' must not be empty!", {
|
|
55
|
+
field: 'msgid-bugs-address',
|
|
56
|
+
})), v.url(gtx._x("The field '{field}' must contain a valid email address or URL!", {
|
|
57
|
+
field: 'msgid-bugs-address',
|
|
58
|
+
}))),
|
|
51
59
|
]);
|
|
52
60
|
const programSchema = (program) => {
|
|
53
61
|
return v.strictObject({
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
27
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
28
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
37
|
};
|
|
15
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
39
|
const yargs_1 = __importDefault(require("yargs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
17
41
|
const package_js_1 = require("./package.js");
|
|
18
42
|
const runtime_1 = require("@esgettext/runtime");
|
|
19
43
|
const configuration_js_1 = require("./configuration.js");
|
|
@@ -38,13 +62,21 @@ const commandNames = [
|
|
|
38
62
|
const configFiles = locateConfigFiles();
|
|
39
63
|
const pkgJsonFile = locatePkgJsonFile();
|
|
40
64
|
const gtx = runtime_1.Textdomain.getInstance('com.cantanea.esgettext-tools');
|
|
65
|
+
runtime_1.Textdomain.locale = runtime_1.Textdomain.selectLocale([
|
|
66
|
+
'en-AU',
|
|
67
|
+
'en-US',
|
|
68
|
+
'en-GB',
|
|
69
|
+
'en-NZ',
|
|
70
|
+
'de',
|
|
71
|
+
]);
|
|
72
|
+
const localePath = path.join(__dirname, 'locale');
|
|
73
|
+
gtx.bindtextdomain(localePath);
|
|
41
74
|
gtx
|
|
42
75
|
.resolve()
|
|
43
76
|
.then(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
77
|
var _a;
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const configuration = yield configuration_js_1.ConfigurationFactory.create(configFiles, pkgJsonFile, locale);
|
|
78
|
+
const ulocale = runtime_1.Textdomain.locale.replace('-', '_');
|
|
79
|
+
const configuration = yield configuration_js_1.ConfigurationFactory.create(configFiles, pkgJsonFile, runtime_1.Textdomain.locale);
|
|
48
80
|
if (!configuration)
|
|
49
81
|
process.exit(1);
|
|
50
82
|
const commands = {
|
|
@@ -74,7 +106,7 @@ gtx
|
|
|
74
106
|
default: 'package.json',
|
|
75
107
|
},
|
|
76
108
|
})
|
|
77
|
-
.showHelpOnFail(false, gtx._x("Try {programName}
|
|
109
|
+
.showHelpOnFail(false, gtx._x("Try '{programName} --help' for more information!", {
|
|
78
110
|
programName: package_js_1.Package.getName(),
|
|
79
111
|
}))
|
|
80
112
|
.demandCommand(1, gtx._('Error: No command given.'))
|
package/dist/optspec.js
CHANGED
|
@@ -18,7 +18,7 @@ function coerceOptions(args, optspecs) {
|
|
|
18
18
|
else {
|
|
19
19
|
if (isArray) {
|
|
20
20
|
console.error(gtx._x('{programName}: Error: The option' +
|
|
21
|
-
'
|
|
21
|
+
" '{optname}' cannot be specified more than once!", { programName: package_1.Package.getName(), optname }));
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
}
|
package/dist/package.js
CHANGED
package/dist/pot/entry.js
CHANGED
|
@@ -21,19 +21,23 @@ class POTEntry {
|
|
|
21
21
|
constructor(properties) {
|
|
22
22
|
this.properties = properties;
|
|
23
23
|
if (/[\u0000-\u0006\u000e-\u001f]/.exec(properties.msgid)) {
|
|
24
|
-
throw new Error(gtx.
|
|
24
|
+
throw new Error(gtx._x("Section '{section}' must not contain control characters.", {
|
|
25
|
+
section: 'msgid',
|
|
26
|
+
}));
|
|
25
27
|
}
|
|
26
28
|
if (typeof this.properties.msgidPlural !== 'undefined') {
|
|
27
29
|
if (/[\u0000-\u0006\u000e-\u001f]/.exec(properties.msgidPlural)) {
|
|
28
|
-
throw new Error(gtx.
|
|
30
|
+
throw new Error(gtx._x("Section '{section}' must not contain control characters.", {
|
|
31
|
+
section: 'msgid_plural',
|
|
32
|
+
}));
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
if (this.properties.msgid === '' &&
|
|
32
36
|
(typeof this.properties.msgctxt === 'undefined' ||
|
|
33
37
|
this.properties.msgctxt === '')) {
|
|
34
38
|
this.warning(gtx._('Empty msgid. It is reserved by esgettext.\n' +
|
|
35
|
-
"Calling gettext('
|
|
36
|
-
'entry with meta information, not the empty ' +
|
|
39
|
+
"Calling 'gettext()' with an empty msgid returns the " +
|
|
40
|
+
' header entry with meta information, not the empty ' +
|
|
37
41
|
'string.\n' +
|
|
38
42
|
'Consider adding a message context, if this ' +
|
|
39
43
|
'is done intentionally.'));
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esgettext/tools",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Gettext-like po creation and manipulation",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gettext",
|
|
7
|
+
"po parser",
|
|
8
|
+
"create po"
|
|
9
|
+
],
|
|
5
10
|
"publishConfig": {
|
|
6
11
|
"access": "public"
|
|
7
12
|
},
|
|
@@ -26,7 +31,7 @@
|
|
|
26
31
|
"prebuild": "node ./write-package.mjs >src/package.ts",
|
|
27
32
|
"prepublishOnly": "npm run build",
|
|
28
33
|
"check:clean": "../../check-clean",
|
|
29
|
-
"format": "prettier --write 'src/**/*.ts'",
|
|
34
|
+
"format": "prettier --write 'src/**/*.ts' *.mjs *.json",
|
|
30
35
|
"watch": "tsc --watch",
|
|
31
36
|
"prewatch": "node ./write-package.mjs >src/package.ts",
|
|
32
37
|
"clean": "rimraf ./dist",
|
|
@@ -39,7 +44,14 @@
|
|
|
39
44
|
"test:watch": "jest --watch",
|
|
40
45
|
"test:cov": "jest --coverage",
|
|
41
46
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
42
|
-
"typedoc": "echo nothing to do"
|
|
47
|
+
"typedoc": "echo nothing to do",
|
|
48
|
+
"esgettext": "npm-run-all esgettext:potfiles esgettext:extract esgettext:update-po esgettext:update-mo esgettext:install",
|
|
49
|
+
"esgettext:potfiles": "node --import=tsx src/index.ts potfiles --directory=po --git --exclude=\"dist/**/*\" --exclude=\"node_modules/**/*\" --exclude=\"**/*.spec.*\" \"./src/**/*.ts\" >po/POTFILES",
|
|
50
|
+
"esgettext:extract": "node --import=tsx src/index.ts extract --directory po --files-from=po/POTFILES --from-code='utf-8'",
|
|
51
|
+
"esgettext:update-po": "node --import=tsx src/index.ts msgmerge-all",
|
|
52
|
+
"esgettext:update-mo": "node --import=tsx src/index.ts msgfmt-all",
|
|
53
|
+
"esgettext:install": "node --import=tsx src/index.ts install",
|
|
54
|
+
"esgettext:addlang": "node --import=tsx src/index.ts msginit"
|
|
43
55
|
},
|
|
44
56
|
"author": "Guido Flohr <guido.flohr@cantanea.com> (http://www.guido.flohr.net/)",
|
|
45
57
|
"license": "WTFPL",
|
|
@@ -70,6 +82,7 @@
|
|
|
70
82
|
},
|
|
71
83
|
"devDependencies": {
|
|
72
84
|
"@babel/types": "^7.24.7",
|
|
85
|
+
"@esgettext/tools": "^1.3.1",
|
|
73
86
|
"@eslint/config-array": "^0.16.0",
|
|
74
87
|
"@humanwhocodes/retry": "^0.3.0",
|
|
75
88
|
"@tsconfig/recommended": "^1.0.6",
|
|
@@ -91,7 +104,7 @@
|
|
|
91
104
|
"dependencies": {
|
|
92
105
|
"@babel/parser": "^7.24.7",
|
|
93
106
|
"@babel/traverse": "^7.24.7",
|
|
94
|
-
"@esgettext/runtime": "^1.3.
|
|
107
|
+
"@esgettext/runtime": "^1.3.2",
|
|
95
108
|
"@inquirer/prompts": "^5.0.6",
|
|
96
109
|
"@npmcli/package-json": "^5.2.0",
|
|
97
110
|
"@valibot/i18n": "^0.15.0",
|
|
@@ -101,5 +114,5 @@
|
|
|
101
114
|
"valibot": "^0.31.1",
|
|
102
115
|
"yargs": "^17.7.2"
|
|
103
116
|
},
|
|
104
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "b143ccc6342c751a27ebccfc345f23fa7cd6e318"
|
|
105
118
|
}
|