@esgettext/tools 1.1.0 → 1.2.0

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.
Files changed (87) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/dist/command.js +0 -1
  4. package/dist/commands/convert.js +16 -14
  5. package/dist/commands/install.js +12 -4
  6. package/dist/commands/msgfmt-all.js +65 -46
  7. package/dist/commands/msgmerge-all.js +64 -46
  8. package/dist/commands/xgettext/file-resolver.js +0 -1
  9. package/dist/commands/xgettext/files-collector.js +1 -1
  10. package/dist/commands/xgettext.js +16 -7
  11. package/dist/configuration.js +172 -156
  12. package/dist/esgettext-package-json.js +0 -1
  13. package/dist/index.js +75 -24
  14. package/dist/package.js +1 -2
  15. package/dist/parser/javascript.js +2 -1
  16. package/dist/parser/parser.js +17 -2
  17. package/dist/parser/po.js +34 -1
  18. package/dist/parser/typescript.js +2 -1
  19. package/dist/pot/catalog.js +36 -1
  20. package/dist/pot/entry.js +71 -1
  21. package/dist/pot/keyword.js +10 -5
  22. package/package.json +5 -4
  23. package/dist/command.d.ts +0 -11
  24. package/dist/command.js.map +0 -1
  25. package/dist/commands/convert.d.ts +0 -24
  26. package/dist/commands/convert.js.map +0 -1
  27. package/dist/commands/install.d.ts +0 -22
  28. package/dist/commands/install.js.map +0 -1
  29. package/dist/commands/msgfmt-all.d.ts +0 -20
  30. package/dist/commands/msgfmt-all.js.map +0 -1
  31. package/dist/commands/msgmerge-all.d.ts +0 -21
  32. package/dist/commands/msgmerge-all.js.map +0 -1
  33. package/dist/commands/xgettext/file-resolver.d.ts +0 -5
  34. package/dist/commands/xgettext/file-resolver.js.map +0 -1
  35. package/dist/commands/xgettext/file-resolver.spec.d.ts +0 -1
  36. package/dist/commands/xgettext/file-resolver.spec.js +0 -22
  37. package/dist/commands/xgettext/file-resolver.spec.js.map +0 -1
  38. package/dist/commands/xgettext/files-collector.d.ts +0 -5
  39. package/dist/commands/xgettext/files-collector.js.map +0 -1
  40. package/dist/commands/xgettext/files-collector.spec.d.ts +0 -1
  41. package/dist/commands/xgettext/files-collector.spec.js +0 -96
  42. package/dist/commands/xgettext/files-collector.spec.js.map +0 -1
  43. package/dist/commands/xgettext.d.ts +0 -29
  44. package/dist/commands/xgettext.js.map +0 -1
  45. package/dist/commands/xgettext.spec.d.ts +0 -1
  46. package/dist/commands/xgettext.spec.js +0 -897
  47. package/dist/commands/xgettext.spec.js.map +0 -1
  48. package/dist/configuration.d.ts +0 -36
  49. package/dist/configuration.js.map +0 -1
  50. package/dist/esgettext-package-json.d.ts +0 -15
  51. package/dist/esgettext-package-json.js.map +0 -1
  52. package/dist/index.d.ts +0 -2
  53. package/dist/index.js.map +0 -1
  54. package/dist/package.d.ts +0 -5
  55. package/dist/package.js.map +0 -1
  56. package/dist/parser/javascript.d.ts +0 -4
  57. package/dist/parser/javascript.js.map +0 -1
  58. package/dist/parser/javascript.spec.d.ts +0 -1
  59. package/dist/parser/javascript.spec.js +0 -535
  60. package/dist/parser/javascript.spec.js.map +0 -1
  61. package/dist/parser/parser.d.ts +0 -45
  62. package/dist/parser/parser.js.map +0 -1
  63. package/dist/parser/po.d.ts +0 -22
  64. package/dist/parser/po.js.map +0 -1
  65. package/dist/parser/po.spec.d.ts +0 -1
  66. package/dist/parser/po.spec.js +0 -486
  67. package/dist/parser/po.spec.js.map +0 -1
  68. package/dist/parser/typescript.d.ts +0 -4
  69. package/dist/parser/typescript.js.map +0 -1
  70. package/dist/parser/typescript.spec.d.ts +0 -1
  71. package/dist/parser/typescript.spec.js +0 -121
  72. package/dist/parser/typescript.spec.js.map +0 -1
  73. package/dist/pot/catalog.d.ts +0 -26
  74. package/dist/pot/catalog.js.map +0 -1
  75. package/dist/pot/catalog.spec.d.ts +0 -1
  76. package/dist/pot/catalog.spec.js +0 -244
  77. package/dist/pot/catalog.spec.js.map +0 -1
  78. package/dist/pot/entry.d.ts +0 -35
  79. package/dist/pot/entry.js.map +0 -1
  80. package/dist/pot/entry.spec.d.ts +0 -1
  81. package/dist/pot/entry.spec.js +0 -433
  82. package/dist/pot/entry.spec.js.map +0 -1
  83. package/dist/pot/keyword.d.ts +0 -17
  84. package/dist/pot/keyword.js.map +0 -1
  85. package/dist/pot/keyword.spec.d.ts +0 -1
  86. package/dist/pot/keyword.spec.js +0 -54
  87. package/dist/pot/keyword.spec.js.map +0 -1
@@ -38,6 +38,9 @@ class Parser {
38
38
  constructor(catalog, options = {}) {
39
39
  this.catalog = catalog;
40
40
  this.options = options;
41
+ this.filename = '';
42
+ this.errors = 0;
43
+ this.comments = [];
41
44
  this.keywords = {};
42
45
  (options.keyword || Parser.cookedDefaultKeywords()).forEach(keyword => {
43
46
  this.keywords[keyword.method] = keyword;
@@ -81,6 +84,7 @@ class Parser {
81
84
  filename,
82
85
  identifierName: null,
83
86
  };
87
+ // Find the offending character.
84
88
  for (let i = 0; i < pos; ++i) {
85
89
  if (buf[i] === 10) {
86
90
  ++loc.start.line;
@@ -105,6 +109,7 @@ class Parser {
105
109
  input = buf.toString();
106
110
  }
107
111
  else {
112
+ // Convert.
108
113
  try {
109
114
  input = (0, iconv_lite_1.decode)(buf, this.options.fromCode);
110
115
  }
@@ -136,11 +141,15 @@ class Parser {
136
141
  });
137
142
  }
138
143
  extractAllStrings(ast) {
144
+ // Step 1: Transform string concatenations into one string.
139
145
  (0, traverse_1.default)(ast, {
140
146
  StringLiteral: path => {
141
147
  this.concatStrings(path);
142
148
  },
143
149
  });
150
+ // Step 2: Extract the remaining strings. Those that are part of a
151
+ // binary expression have not been recognized in step 1 and must be
152
+ // ignored.
144
153
  (0, traverse_1.default)(ast, {
145
154
  StringLiteral: path => {
146
155
  if (!t.isBinaryExpression(path.parentPath.node)) {
@@ -165,7 +174,7 @@ class Parser {
165
174
  return true;
166
175
  }
167
176
  checkInstance(instance) {
168
- if (!this.options.instance) {
177
+ if (!this.instances) {
169
178
  return true;
170
179
  }
171
180
  for (let i = 0; i < this.instances.length; ++i) {
@@ -197,6 +206,7 @@ class Parser {
197
206
  if (!Object.prototype.hasOwnProperty.call(this.keywords, method)) {
198
207
  return;
199
208
  }
209
+ // Enough arguments?
200
210
  const keywordSpec = this.keywords[method];
201
211
  if (keywordSpec.totalArgs &&
202
212
  path.node.arguments.length !== keywordSpec.totalArgs) {
@@ -347,12 +357,14 @@ class Parser {
347
357
  else if (t.isMemberExpression(me.object) &&
348
358
  t.isIdentifier(me.property) &&
349
359
  !me.computed) {
360
+ // Recurse.
350
361
  instance.push(me.property.name);
351
362
  return this.methodFromMemberExpression(me.object, instance);
352
363
  }
353
364
  else if (t.isMemberExpression(me.object) &&
354
365
  t.isLiteral(me.property) &&
355
366
  me.computed) {
367
+ // Recurse.
356
368
  instance.push(this.literalValue(me.property));
357
369
  return this.methodFromMemberExpression(me.object, instance);
358
370
  }
@@ -376,6 +388,8 @@ class Parser {
376
388
  }
377
389
  findPrecedingComments(loc) {
378
390
  let last;
391
+ // Find the last relevant comment, which is the first one that
392
+ // immediately precedes the location.
379
393
  for (last = 0; last < this.comments.length; ++last) {
380
394
  const commentLocation = this.comments[last].loc;
381
395
  if (commentLocation.end.line === loc.start.line ||
@@ -391,6 +405,7 @@ class Parser {
391
405
  this.comments.splice(0, this.comments.length);
392
406
  return [];
393
407
  }
408
+ // Now go back and find all adjacent comments.
394
409
  let ptr = this.comments[last].loc;
395
410
  const preceding = this.comments.splice(0, last + 1);
396
411
  if (!last) {
@@ -476,6 +491,7 @@ class Parser {
476
491
  console.error(gtx._x('{location}: Error: {msg}', { location, msg }));
477
492
  }
478
493
  canonicalizeEncoding(encoding) {
494
+ // This is taken from iconv-lite.
479
495
  const canonical = ('' + encoding)
480
496
  .toLowerCase()
481
497
  .replace(/:[0-9]{4}$|[^0-9a-z]/g, '');
@@ -592,4 +608,3 @@ class Parser {
592
608
  }
593
609
  }
594
610
  exports.Parser = Parser;
595
- //# sourceMappingURL=parser.js.map
package/dist/parser/po.js CHANGED
@@ -7,6 +7,26 @@ const entry_1 = require("../pot/entry");
7
7
  const parser_1 = require("./parser");
8
8
  const gtx = runtime_1.Textdomain.getInstance('tools');
9
9
  class PoParser extends parser_1.Parser {
10
+ constructor() {
11
+ super(...arguments);
12
+ // All those get reset on each call to parse().
13
+ this.entry = undefined;
14
+ this.loc = undefined;
15
+ this.entryLoc = undefined;
16
+ this.msgType = undefined;
17
+ this.seen = {};
18
+ }
19
+ /**
20
+ * Parse a po file into a catalog. This parser is very forgiving and
21
+ * accepts input that actually does not follow the standard in certain
22
+ * areas.
23
+ *
24
+ * The encoding will always be read from the PO header if present.
25
+ *
26
+ * @param input - the content of the po file
27
+ * @param filename - the filename
28
+ * @param encoding - an optional encoding
29
+ */
10
30
  parse(buf, filename, encoding) {
11
31
  if (typeof encoding !== 'undefined') {
12
32
  if (!(0, iconv_lite_1.encodingExists)(encoding)) {
@@ -15,6 +35,7 @@ class PoParser extends parser_1.Parser {
15
35
  }
16
36
  }
17
37
  const input = typeof encoding === 'undefined' ? buf.toString() : (0, iconv_lite_1.decode)(buf, encoding);
38
+ // Reset parser.
18
39
  this.entry = undefined;
19
40
  this.filename = filename;
20
41
  this.loc = {
@@ -34,6 +55,8 @@ class PoParser extends parser_1.Parser {
34
55
  this.msgType = undefined;
35
56
  this.seen = {};
36
57
  this.errors = 0;
58
+ // We cannot use forEach here because we may have to return from
59
+ // inside the loop.
37
60
  const lines = input.split('\n');
38
61
  for (let i = 0; i < lines.length; ++i) {
39
62
  const line = lines[i];
@@ -48,6 +71,9 @@ class PoParser extends parser_1.Parser {
48
71
  if (charset &&
49
72
  (typeof encoding === 'undefined' ||
50
73
  charset.toLowerCase() !== encoding.toLowerCase())) {
74
+ // FIXME! This must only happen, if the header is the first
75
+ // entry that has been added. Otherwise, we'll add the entries
76
+ // before this, twice.
51
77
  return this.parse(buf, filename, charset);
52
78
  }
53
79
  }
@@ -99,6 +125,9 @@ class PoParser extends parser_1.Parser {
99
125
  if (charset &&
100
126
  (typeof encoding === 'undefined' ||
101
127
  charset.toLowerCase() !== encoding.toLowerCase())) {
128
+ // FIXME! This must only happen, if the header is the first
129
+ // entry that has been added. Otherwise, we'll add the entries
130
+ // before this, twice.
102
131
  return this.parse(buf, filename, charset);
103
132
  }
104
133
  }
@@ -106,9 +135,11 @@ class PoParser extends parser_1.Parser {
106
135
  if (this.errors) {
107
136
  return false;
108
137
  }
138
+ // FIXME! This must go into the caller!
109
139
  this.catalog.makePOT();
110
140
  return true;
111
141
  }
142
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
143
  doParse(_input, _filename) {
113
144
  throw new Error('not implemented');
114
145
  }
@@ -150,6 +181,7 @@ class PoParser extends parser_1.Parser {
150
181
  const msgctxt = this.entry.properties.msgctxt;
151
182
  const msgid = this.entry.properties.msgid;
152
183
  if (typeof msgid === 'undefined') {
184
+ // TRANSLATORS: Do not translate "msgid".
153
185
  this.error(gtx._('missing "msgid" section'), this.loc);
154
186
  return;
155
187
  }
@@ -275,6 +307,7 @@ class PoParser extends parser_1.Parser {
275
307
  retval = '\r';
276
308
  break;
277
309
  default:
310
+ // We have to take the leading quote into account.
278
311
  this.loc.start.column += offset + 1;
279
312
  this.error(gtx._('invalid control sequence'), this.loc);
280
313
  retval = '';
@@ -298,6 +331,7 @@ class PoParser extends parser_1.Parser {
298
331
  this.entry.addToMsgctxt(msg);
299
332
  break;
300
333
  default:
334
+ // Ignore plural translations.
301
335
  break;
302
336
  }
303
337
  }
@@ -374,4 +408,3 @@ class PoParser extends parser_1.Parser {
374
408
  }
375
409
  }
376
410
  exports.PoParser = PoParser;
377
- //# sourceMappingURL=po.js.map
@@ -11,6 +11,8 @@ class TypeScriptParser extends parser_2.Parser {
11
11
  allowReturnOutsideFunction: true,
12
12
  allowSuperOutsideMethod: true,
13
13
  allowUndeclaredExports: true,
14
+ // Documented but not supported. FIXME! Maybe only missing in types.
15
+ // errorRecovery: true,
14
16
  sourceFilename: filename,
15
17
  plugins: [
16
18
  'typescript',
@@ -25,4 +27,3 @@ class TypeScriptParser extends parser_2.Parser {
25
27
  }
26
28
  }
27
29
  exports.TypeScriptParser = TypeScriptParser;
28
- //# sourceMappingURL=typescript.js.map
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Catalog = void 0;
4
4
  const entry_1 = require("./entry");
5
+ /**
6
+ * An entire message catalog that is subsequently filled.
7
+ */
5
8
  class Catalog {
6
9
  constructor(properties = {}) {
7
10
  this.properties = properties;
@@ -26,6 +29,7 @@ class Catalog {
26
29
  }
27
30
  if (typeof properties.date === 'undefined') {
28
31
  const now = new Date();
32
+ // Avoid if/else, so we do not spoil our test coverage. :)
29
33
  let year = now.getFullYear().toString();
30
34
  year = '0'.repeat(4 - year.length) + year;
31
35
  let month = (1 + now.getMonth()).toString();
@@ -36,6 +40,7 @@ class Catalog {
36
40
  hour = '0'.repeat(2 - hour.length) + hour;
37
41
  let minutes = now.getMinutes().toString();
38
42
  minutes = '0'.repeat(2 - minutes.length) + minutes;
43
+ // Do not depend on the timezone for test coverage.
39
44
  let offset = now.getTimezoneOffset();
40
45
  const sign = ['+', '-'][Math.sign(offset) + 1];
41
46
  offset = Math.abs(offset);
@@ -85,6 +90,17 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
85
90
  });
86
91
  this.addEntry(headerEntry);
87
92
  }
93
+ /**
94
+ * Render the entire catalog.
95
+ *
96
+ * @param renderOptions - options for rendering
97
+ *
98
+ * The following options are supported:
99
+ *
100
+ * width: wrap lines to that page width (default: 76)
101
+ *
102
+ * @returns the catalog rendered as a po(t) file
103
+ */
88
104
  toString(options = {}) {
89
105
  const width = options && typeof options.width !== 'undefined' ? options.width : 76;
90
106
  const isNotHeader = (entry) => {
@@ -111,6 +127,9 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
111
127
  }
112
128
  const actx = a.properties.msgctxt;
113
129
  const bctx = b.properties.msgctxt;
130
+ // It is impossible that both msgctxts are undefined
131
+ // because that would mean that the msgids are identical
132
+ // which is prevented.
114
133
  if (typeof bctx === 'undefined') {
115
134
  return +1;
116
135
  }
@@ -130,6 +149,7 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
130
149
  const filename = parts.join(':');
131
150
  return { filename, lineno };
132
151
  };
152
+ // First order all references
133
153
  copy.entries.forEach(entry => {
134
154
  if (entry.properties.references) {
135
155
  entry.properties.references = entry.properties.references
@@ -183,6 +203,13 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
183
203
  return header || body || '';
184
204
  }
185
205
  }
206
+ /**
207
+ * Add an entry to the catalog. If an entry with the same msgid
208
+ * and msgctxt already exists, the entry is merged into
209
+ * the existing one instead.
210
+ *
211
+ * @param entry - the `POTEntry` to add
212
+ */
186
213
  addEntry(entry) {
187
214
  const msgid = entry.properties.msgid;
188
215
  const msgctxt = entry.properties.msgctxt;
@@ -208,11 +235,20 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
208
235
  delete this.cache[msgid][msgctxt];
209
236
  this.entries = this.entries.filter(other => other !== entry);
210
237
  }
238
+ /**
239
+ * Copy a catalog with other options. This is for testing only.
240
+ *
241
+ * @returns a deep copy of the catalog.
242
+ */
211
243
  copy(properties) {
212
244
  const other = new Catalog(properties);
213
245
  this.entries.forEach(entry => other.addEntry(entry));
214
246
  return other;
215
247
  }
248
+ /**
249
+ * Removes all translations from a catalog, so that it can be used as
250
+ * a .pot file.
251
+ */
216
252
  makePOT() {
217
253
  this.entries.forEach(entry => {
218
254
  if (!(entry.properties.msgid === '' &&
@@ -223,4 +259,3 @@ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
223
259
  }
224
260
  }
225
261
  exports.Catalog = Catalog;
226
- //# sourceMappingURL=catalog.js.map
package/dist/pot/entry.js CHANGED
@@ -3,7 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.POTEntry = void 0;
4
4
  const runtime_1 = require("@esgettext/runtime");
5
5
  const gtx = runtime_1.Textdomain.getInstance('tools');
6
+ /**
7
+ * Class representing one entry in a POT file. This is simpler than a PO
8
+ * entry because a couple of things can be ignored:
9
+ *
10
+ * - no translations
11
+ * - no obsolete entries
12
+ * - no previous translations
13
+ */
6
14
  class POTEntry {
15
+ /**
16
+ * Create an entry.
17
+ *
18
+ * @param properties - the properties of the entry
19
+ * @param options - options for wrapping
20
+ */
7
21
  constructor(properties) {
8
22
  this.properties = properties;
9
23
  if (/[\u0000-\u0006\u000e-\u001f]/.exec(properties.msgid)) {
@@ -24,9 +38,12 @@ class POTEntry {
24
38
  'Consider adding a message context, if this ' +
25
39
  'is done intentionally.'));
26
40
  }
41
+ // Order matters here. This is most likely the order of appearance
42
+ // in the source file.
27
43
  this.checkDeprecatedControls(this.properties.msgctxt);
28
44
  this.checkDeprecatedControls(this.properties.msgid);
29
45
  this.checkDeprecatedControls(this.properties.msgidPlural);
46
+ // See https://savannah.gnu.org/bugs/index.php?58356
30
47
  this.checkReferences();
31
48
  this.checkFlags();
32
49
  }
@@ -35,6 +52,14 @@ class POTEntry {
35
52
  entry.properties.msgid = undefined;
36
53
  return entry;
37
54
  }
55
+ /**
56
+ * Serialize the entry to a string that can be put into a POT file.
57
+ *
58
+ * (Some) long lines are wrapped to `width` characters. If `width` is
59
+ * less or equal to zero, lines are not wrapped
60
+ *
61
+ * @param width - the requested page width
62
+ */
38
63
  toString(width = 76) {
39
64
  let out = '';
40
65
  if (typeof this.properties.translatorComments !== 'undefined') {
@@ -93,6 +118,12 @@ class POTEntry {
93
118
  }
94
119
  return out;
95
120
  }
121
+ /**
122
+ * Merge to POT entries into one. It is a assumed that both entries share
123
+ * the same `msgid`, `msgidPlural`, and `msgContext`.
124
+ *
125
+ * @param other - the other POT entry
126
+ */
96
127
  merge(other) {
97
128
  if (other.properties.translatorComments) {
98
129
  if (!this.properties.translatorComments) {
@@ -138,48 +169,88 @@ class POTEntry {
138
169
  this.properties.references.push(...other.properties.references);
139
170
  }
140
171
  }
172
+ /**
173
+ * Add an extracted comment line. These are comments starting with "#.".
174
+ *
175
+ * @param line - one comment line to add
176
+ */
141
177
  addExtractedCommentLine(line) {
142
178
  if (!this.properties.extractedComments) {
143
179
  this.properties.extractedComments = [];
144
180
  }
145
181
  this.properties.extractedComments.push(line);
146
182
  }
183
+ /**
184
+ * Add a normal comment line.
185
+ *
186
+ * @param line - one comment line to add
187
+ */
147
188
  addTranslatorCommentLine(line) {
148
189
  if (!this.properties.translatorComments) {
149
190
  this.properties.translatorComments = [];
150
191
  }
151
192
  this.properties.translatorComments.push(line);
152
193
  }
194
+ /**
195
+ * Add a flag.
196
+ *
197
+ * @param flags - the flag to add
198
+ */
153
199
  addFlag(flag) {
154
200
  if (!this.properties.flags) {
155
201
  this.properties.flags = [];
156
202
  }
157
203
  this.properties.flags.push(flag);
158
204
  }
205
+ /**
206
+ * Add a reference.
207
+ *
208
+ * @param reference - the reference to add
209
+ */
159
210
  addReference(reference) {
160
211
  if (!this.properties.references) {
161
212
  this.properties.references = [];
162
213
  }
163
214
  this.properties.references.push(reference);
164
215
  }
216
+ /**
217
+ * Add a string chunk to the msgid.
218
+ *
219
+ * @param chunk - the chunk to add
220
+ */
165
221
  addToMsgid(chunk) {
166
222
  if (typeof this.properties.msgid === 'undefined') {
167
223
  this.properties.msgid = '';
168
224
  }
169
225
  this.properties.msgid += chunk;
170
226
  }
227
+ /**
228
+ * Add a string chunk to the msgid_plural.
229
+ *
230
+ * @param chunk - the chunk to add
231
+ */
171
232
  addToMsgidPlural(chunk) {
172
233
  if (typeof this.properties.msgidPlural === 'undefined') {
173
234
  this.properties.msgidPlural = '';
174
235
  }
175
236
  this.properties.msgidPlural += chunk;
176
237
  }
238
+ /**
239
+ * Add a string chunk to the msgstr.
240
+ *
241
+ * @param chunk - the chunk to add
242
+ */
177
243
  addToMsgstr(chunk) {
178
244
  if (typeof this.properties.msgstr === 'undefined') {
179
245
  this.properties.msgstr = '';
180
246
  }
181
247
  this.properties.msgstr += chunk;
182
248
  }
249
+ /**
250
+ * Add a string chunk to the msgctxt.
251
+ *
252
+ * @param chunk - the chunk to add
253
+ */
183
254
  addToMsgctxt(chunk) {
184
255
  if (typeof this.properties.msgctxt === 'undefined') {
185
256
  this.properties.msgctxt = '';
@@ -307,4 +378,3 @@ class POTEntry {
307
378
  }
308
379
  }
309
380
  exports.POTEntry = POTEntry;
310
- //# sourceMappingURL=entry.js.map
@@ -3,8 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Keyword = void 0;
4
4
  const runtime_1 = require("@esgettext/runtime");
5
5
  const gtx = runtime_1.Textdomain.getInstance('tools');
6
+ /**
7
+ * This is a direct port of Locale::XGettext::Util::Keyword
8
+ * (https://github.com/gflohr/Locale-XGettext/blob/master/lib/Locale/XGettext/Util/Keyword.pm)
9
+ * to JavaScript. See
10
+ * https://github.com/gflohr/Locale-XGettext/blob/master/lib/Locale/XGettext/Util/Keyword.pod
11
+ * for more information!
12
+ */
6
13
  class Keyword {
7
14
  constructor(method, args) {
15
+ var _a;
8
16
  this._method = method;
9
17
  if (!args) {
10
18
  args = new Array();
@@ -46,7 +54,7 @@ class Keyword {
46
54
  function: method,
47
55
  }));
48
56
  }
49
- else if (this.singular) {
57
+ else if (this._singular) {
50
58
  this._plural = pos;
51
59
  }
52
60
  else {
@@ -68,9 +76,7 @@ class Keyword {
68
76
  }
69
77
  }
70
78
  });
71
- if (!this._singular) {
72
- this._singular = 1;
73
- }
79
+ (_a = this._singular) !== null && _a !== void 0 ? _a : (this._singular = 1);
74
80
  }
75
81
  static from(spec) {
76
82
  const tokens = new Array();
@@ -147,4 +153,3 @@ class Keyword {
147
153
  }
148
154
  }
149
155
  exports.Keyword = Keyword;
150
- //# sourceMappingURL=keyword.js.map
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@esgettext/tools",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Gettext-like po creation and manipulation",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "main": "dist/index.js",
9
- "types": "dist/index.d.ts",
9
+ "typings": "dist/index.d.ts",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/gflohr/esgettext.git"
@@ -72,6 +72,7 @@
72
72
  "@babel/types": "^7.24.7",
73
73
  "@eslint/config-array": "^0.16.0",
74
74
  "@humanwhocodes/retry": "^0.3.0",
75
+ "@tsconfig/recommended": "^1.0.6",
75
76
  "@types/glob": "^8.1.0",
76
77
  "@types/jest": "^29.5.12",
77
78
  "@types/jsonfile": "^6.1.4",
@@ -88,7 +89,7 @@
88
89
  "dependencies": {
89
90
  "@babel/parser": "^7.24.7",
90
91
  "@babel/traverse": "^7.24.7",
91
- "@esgettext/runtime": "^1.1.0",
92
+ "@esgettext/runtime": "^1.2.0",
92
93
  "@valibot/i18n": "^0.15.0",
93
94
  "iconv-lite": "^0.6.3",
94
95
  "jsonfile": "^6.1.0",
@@ -96,5 +97,5 @@
96
97
  "valibot": "^0.31.1",
97
98
  "yargs": "^17.7.2"
98
99
  },
99
- "gitHead": "ecd3f8bfeb399c69e5e4bf13aa20f6129f3ad847"
100
+ "gitHead": "b3027a2934ec19444374e984673099f26cfccff7"
100
101
  }
package/dist/command.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import yargs from 'yargs';
2
- export interface Command {
3
- synopsis(): string;
4
- description(): string;
5
- aliases(): Array<string>;
6
- args(): {
7
- [key: string]: yargs.Options;
8
- };
9
- additional(argv: yargs.Argv): void;
10
- run(argv: yargs.Arguments): Promise<number>;
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import yargs from 'yargs';
2
- import { Command } from '../command';
3
- import { Configuration } from '../configuration';
4
- export declare class Convert implements Command {
5
- private options;
6
- private readonly configuration;
7
- constructor(configuration: Configuration);
8
- synopsis(): string;
9
- description(): string;
10
- aliases(): Array<string>;
11
- args(): {
12
- [key: string]: yargs.Options;
13
- };
14
- additional(argv: yargs.Argv): void;
15
- private init;
16
- run(argv: yargs.Arguments): Promise<number>;
17
- private getFileFormat;
18
- private checkInputFormat;
19
- private checkOutputFormat;
20
- private readInput;
21
- private convert;
22
- private shortenAndEscapeString;
23
- private output;
24
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/commands/convert.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAGzB,gDAK4B;AAE5B,wCAAqC;AAErC,MAAM,GAAG,GAAG,oBAAU,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAC;AAcnE,MAAa,OAAO;IAInB,YAAY,aAA4B;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC;IAC3D,CAAC;IAED,WAAW;QACV,OAAO,GAAG,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO;QACN,OAAO,EAAE,CAAC;IACX,CAAC;IAED,IAAI;QACH,OAAO;YACN,KAAK,EAAE;gBACN,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,iCAAiC,CAAC;gBAClD,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;aAC/B;YACD,MAAM,EAAE;gBACP,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,mCAAmC,CAAC;gBACpD,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;aAC/B;YACD,cAAc,EAAE;gBACf,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,GAAG,CA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AAK,CACV,GAAG,CAAC,EAAE,CAAC,mCAAmC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAChE,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;CACD;AA5VD,0BA4VC"}
@@ -1,22 +0,0 @@
1
- import { Command } from '../command';
2
- import yargs from 'yargs';
3
- import { Configuration } from '../configuration';
4
- export declare class Install implements Command {
5
- private locales;
6
- private options;
7
- private readonly configuration;
8
- constructor(configuration: Configuration);
9
- synopsis(): string;
10
- description(): string;
11
- aliases(): Array<string>;
12
- args(): {
13
- [key: string]: yargs.Options;
14
- };
15
- additional(_: yargs.Argv): void;
16
- private init;
17
- run(argv: yargs.Arguments): Promise<number>;
18
- private installMoLocale;
19
- private installMoJsonLocale;
20
- private installJsonLocale;
21
- private installLocale;
22
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAmE;AAEnE,gDAAgE;AAEhE,+CAAiC;AAcjC,MAAM,GAAG,GAAG,oBAAU,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAC;AAEnE,MAAa,OAAO;IAKnB,YAAY,aAA4B;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IAED,QAAQ;QACP,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC3B,CAAC;IAED,WAAW;QACV,OAAO,GAAG,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO;QACN,OAAO,EAAE,CAAC;IACX,CAAC;IAED,IAAI;;QACH,OAAO;YACN,OAAO,EAAE;gBACR,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,4BAA4B,CAAC;gBAC7C,YAAY,EAAE,IAAI;gBAClB,OAAO,EAAE,MAAA,IAA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,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,GAAG,CAAC;QACX,CAAC;IACF,CAAC;CACD;AA1QD,0BA0QC"}
@@ -1,20 +0,0 @@
1
- import { Command } from '../command';
2
- import yargs from 'yargs';
3
- import { Configuration } from '../configuration';
4
- export declare class MsgfmtAll implements Command {
5
- private locales;
6
- private options;
7
- private readonly configuration;
8
- constructor(configuration: Configuration);
9
- synopsis(): string;
10
- description(): string;
11
- aliases(): Array<string>;
12
- args(): {
13
- [key: string]: yargs.Options;
14
- };
15
- additional(_: yargs.Argv): void;
16
- private init;
17
- run(argv: yargs.Arguments): Promise<number>;
18
- private convertOptions;
19
- private msgfmtLocale;
20
- }