@esgettext/tools 1.2.0 → 1.3.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/dist/commands/add-language.js +100 -0
- package/dist/commands/convert.js +1 -1
- package/dist/commands/init.js +743 -0
- package/dist/commands/install.js +11 -3
- package/dist/commands/msgfmt-all.js +7 -4
- package/dist/commands/msgmerge-all.js +8 -4
- package/dist/commands/potfiles.js +165 -0
- package/dist/commands/xgettext.js +21 -10
- package/dist/configuration.js +140 -97
- package/dist/index.js +25 -8
- package/dist/optspec.js +28 -0
- package/dist/package.js +4 -1
- package/package.json +9 -5
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AddLanguage = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const runtime_1 = require("@esgettext/runtime");
|
|
29
|
+
const gtx = runtime_1.Textdomain.getInstance('com.cantanea.esgettext-tools');
|
|
30
|
+
class AddLanguage {
|
|
31
|
+
constructor(configuration) {
|
|
32
|
+
this.options = undefined;
|
|
33
|
+
this.configuration = configuration;
|
|
34
|
+
}
|
|
35
|
+
synopsis() {
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
description() {
|
|
39
|
+
return gtx._('Describe process for adding languages.');
|
|
40
|
+
}
|
|
41
|
+
aliases() {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
args() {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return {
|
|
47
|
+
textdomain: {
|
|
48
|
+
alias: 't',
|
|
49
|
+
type: 'string',
|
|
50
|
+
describe: gtx._('The textdomain of your package'),
|
|
51
|
+
demandOption: true,
|
|
52
|
+
default: (_a = this.configuration.package) === null || _a === void 0 ? void 0 : _a.textdomain,
|
|
53
|
+
},
|
|
54
|
+
'po-directory': {
|
|
55
|
+
type: 'string',
|
|
56
|
+
describe: gtx._('Directory where your po files are located'),
|
|
57
|
+
demandOption: true,
|
|
58
|
+
default: (_b = this.configuration.po) === null || _b === void 0 ? void 0 : _b.directory,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
|
+
additional(_) { }
|
|
64
|
+
init(argv) {
|
|
65
|
+
const options = argv;
|
|
66
|
+
this.options = options;
|
|
67
|
+
}
|
|
68
|
+
run(argv) {
|
|
69
|
+
return new Promise(resolve => {
|
|
70
|
+
var _a;
|
|
71
|
+
this.init(argv);
|
|
72
|
+
const potFile = `${this.options.poDirectory}/${this.options.textdomain}.pot`.replace(/\//g, path.sep);
|
|
73
|
+
console.log(gtx._('Please execute this command:\n'));
|
|
74
|
+
// TRANSLATORS: Please replace 'll' with a two-letter abbreviation
|
|
75
|
+
// for the word 'language' and 'CC' with a two-letter abbreviation
|
|
76
|
+
// for the workd 'country'.
|
|
77
|
+
const llCC = gtx._('ll_CC');
|
|
78
|
+
console.log(`\tmsginit --input=${potFile} --locale=${llCC}\n`);
|
|
79
|
+
console.log(gtx._x("Replace '{placeholder}' with the two-letter" +
|
|
80
|
+
' language code of the language, optionally' +
|
|
81
|
+
' followed by an underscore and the two-letter' +
|
|
82
|
+
' country code.', { placeholder: llCC }));
|
|
83
|
+
console.log(gtx._('If you prefer to separate language and country' +
|
|
84
|
+
' by a hyphen, rename the file later.'));
|
|
85
|
+
console.log(gtx._x('When you are done, update the list of locales' +
|
|
86
|
+
" in the configuration file '{filename}'. The" +
|
|
87
|
+
" variable name is '{varname}'.", {
|
|
88
|
+
filename: (_a = this.configuration.files) === null || _a === void 0 ? void 0 : _a[0],
|
|
89
|
+
varname: 'po.locales',
|
|
90
|
+
}));
|
|
91
|
+
const redOn = '\x1b[31m';
|
|
92
|
+
const redOff = '\x1b[0m';
|
|
93
|
+
console.log(redOn, gtx._('Warning! The command will open an' +
|
|
94
|
+
' internet connection to download the plural' +
|
|
95
|
+
' function and some other data for that language!'), redOff);
|
|
96
|
+
resolve(0);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.AddLanguage = AddLanguage;
|
package/dist/commands/convert.js
CHANGED
|
@@ -59,7 +59,7 @@ class Convert {
|
|
|
59
59
|
'input-format': {
|
|
60
60
|
alias: 'I',
|
|
61
61
|
type: 'string',
|
|
62
|
-
describe: gtx._('Input file format (
|
|
62
|
+
describe: gtx._('Input file format (default: derived from filename)'),
|
|
63
63
|
choices: ['mo.json', 'mo', 'gmo', 'json'],
|
|
64
64
|
coerce: arg => arg.toLowerCase(),
|
|
65
65
|
group: gtx._('File formats:'),
|