@esgettext/tools 1.0.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 (113) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +197 -22
  3. package/dist/command.js +2 -0
  4. package/dist/commands/convert.js +286 -0
  5. package/dist/commands/install.js +257 -0
  6. package/dist/commands/msgfmt-all.js +219 -0
  7. package/dist/commands/msgmerge-all.js +230 -0
  8. package/dist/commands/xgettext/file-resolver.js +20 -0
  9. package/dist/commands/xgettext/files-collector.js +39 -0
  10. package/dist/commands/xgettext.js +534 -0
  11. package/dist/configuration.js +277 -0
  12. package/dist/esgettext-package-json.js +2 -0
  13. package/dist/index.js +135 -0
  14. package/dist/package.js +10 -12
  15. package/dist/parser/javascript.js +9 -28
  16. package/dist/parser/parser.js +176 -148
  17. package/dist/parser/po.js +144 -128
  18. package/dist/parser/typescript.js +10 -28
  19. package/dist/pot/catalog.js +134 -83
  20. package/dist/pot/entry.js +173 -115
  21. package/dist/pot/keyword.js +66 -92
  22. package/package.json +38 -25
  23. package/bin/esgettext-install.js +0 -5
  24. package/bin/esgettext-mo2json.js +0 -5
  25. package/bin/esgettext-msgfmt-all.js +0 -5
  26. package/bin/esgettext-msgmerge-all.js +0 -5
  27. package/bin/esgettext-xgettext.js +0 -5
  28. package/dist/cli/getopt.d.ts +0 -34
  29. package/dist/cli/getopt.js +0 -150
  30. package/dist/cli/getopt.js.map +0 -1
  31. package/dist/cli/getopt.spec.d.ts +0 -1
  32. package/dist/cli/getopt.spec.js +0 -164
  33. package/dist/cli/getopt.spec.js.map +0 -1
  34. package/dist/cli/install.d.ts +0 -1
  35. package/dist/cli/install.js +0 -91
  36. package/dist/cli/install.js.map +0 -1
  37. package/dist/cli/mo2json-cli.d.ts +0 -1
  38. package/dist/cli/mo2json-cli.js +0 -48
  39. package/dist/cli/mo2json-cli.js.map +0 -1
  40. package/dist/cli/msgfmt-all.d.ts +0 -1
  41. package/dist/cli/msgfmt-all.js +0 -99
  42. package/dist/cli/msgfmt-all.js.map +0 -1
  43. package/dist/cli/msgmerge-all.d.ts +0 -1
  44. package/dist/cli/msgmerge-all.js +0 -85
  45. package/dist/cli/msgmerge-all.js.map +0 -1
  46. package/dist/cli/xgettext-cli.d.ts +0 -1
  47. package/dist/cli/xgettext-cli.js +0 -303
  48. package/dist/cli/xgettext-cli.js.map +0 -1
  49. package/dist/install/install.d.ts +0 -10
  50. package/dist/install/install.js +0 -157
  51. package/dist/install/install.js.map +0 -1
  52. package/dist/msgfmt-all/msgfmt-all.d.ts +0 -8
  53. package/dist/msgfmt-all/msgfmt-all.js +0 -142
  54. package/dist/msgfmt-all/msgfmt-all.js.map +0 -1
  55. package/dist/msgmerge-all/msgmerge-all.d.ts +0 -9
  56. package/dist/msgmerge-all/msgmerge-all.js +0 -157
  57. package/dist/msgmerge-all/msgmerge-all.js.map +0 -1
  58. package/dist/package.d.ts +0 -4
  59. package/dist/package.js.map +0 -1
  60. package/dist/parser/__snapshots__/javascript.spec.js.snap +0 -56
  61. package/dist/parser/__snapshots__/po.spec.js.snap +0 -176
  62. package/dist/parser/javascript.d.ts +0 -4
  63. package/dist/parser/javascript.js.map +0 -1
  64. package/dist/parser/javascript.spec.d.ts +0 -1
  65. package/dist/parser/javascript.spec.js +0 -436
  66. package/dist/parser/javascript.spec.js.map +0 -1
  67. package/dist/parser/parser.d.ts +0 -45
  68. package/dist/parser/parser.js.map +0 -1
  69. package/dist/parser/po.d.ts +0 -22
  70. package/dist/parser/po.js.map +0 -1
  71. package/dist/parser/po.spec.d.ts +0 -1
  72. package/dist/parser/po.spec.js +0 -296
  73. package/dist/parser/po.spec.js.map +0 -1
  74. package/dist/parser/typescript.d.ts +0 -4
  75. package/dist/parser/typescript.js.map +0 -1
  76. package/dist/parser/typescript.spec.d.ts +0 -1
  77. package/dist/parser/typescript.spec.js +0 -106
  78. package/dist/parser/typescript.spec.js.map +0 -1
  79. package/dist/pot/__snapshots__/catalog.spec.js.snap +0 -591
  80. package/dist/pot/catalog.d.ts +0 -26
  81. package/dist/pot/catalog.js.map +0 -1
  82. package/dist/pot/catalog.spec.d.ts +0 -1
  83. package/dist/pot/catalog.spec.js +0 -240
  84. package/dist/pot/catalog.spec.js.map +0 -1
  85. package/dist/pot/entry.d.ts +0 -35
  86. package/dist/pot/entry.js.map +0 -1
  87. package/dist/pot/entry.spec.d.ts +0 -1
  88. package/dist/pot/entry.spec.js +0 -317
  89. package/dist/pot/entry.spec.js.map +0 -1
  90. package/dist/pot/keyword.d.ts +0 -17
  91. package/dist/pot/keyword.js.map +0 -1
  92. package/dist/pot/keyword.spec.d.ts +0 -1
  93. package/dist/pot/keyword.spec.js +0 -54
  94. package/dist/pot/keyword.spec.js.map +0 -1
  95. package/dist/xgettext/__snapshots__/xgettext.spec.js.snap +0 -462
  96. package/dist/xgettext/file-resolver.d.ts +0 -5
  97. package/dist/xgettext/file-resolver.js +0 -23
  98. package/dist/xgettext/file-resolver.js.map +0 -1
  99. package/dist/xgettext/file-resolver.spec.d.ts +0 -1
  100. package/dist/xgettext/file-resolver.spec.js +0 -22
  101. package/dist/xgettext/file-resolver.spec.js.map +0 -1
  102. package/dist/xgettext/files-collector.d.ts +0 -5
  103. package/dist/xgettext/files-collector.js +0 -41
  104. package/dist/xgettext/files-collector.js.map +0 -1
  105. package/dist/xgettext/files-collector.spec.d.ts +0 -1
  106. package/dist/xgettext/files-collector.spec.js +0 -78
  107. package/dist/xgettext/files-collector.spec.js.map +0 -1
  108. package/dist/xgettext/xgettext.d.ts +0 -16
  109. package/dist/xgettext/xgettext.js +0 -335
  110. package/dist/xgettext/xgettext.js.map +0 -1
  111. package/dist/xgettext/xgettext.spec.d.ts +0 -1
  112. package/dist/xgettext/xgettext.spec.js +0 -743
  113. package/dist/xgettext/xgettext.spec.js.map +0 -1
package/dist/pot/entry.js CHANGED
@@ -1,10 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.POTEntry = void 0;
4
- var runtime_1 = require("@esgettext/runtime");
5
- var gtx = runtime_1.Textdomain.getInstance('tools');
6
- var POTEntry = (function () {
7
- function POTEntry(properties) {
4
+ const runtime_1 = require("@esgettext/runtime");
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
+ */
14
+ class POTEntry {
15
+ /**
16
+ * Create an entry.
17
+ *
18
+ * @param properties - the properties of the entry
19
+ * @param options - options for wrapping
20
+ */
21
+ constructor(properties) {
8
22
  this.properties = properties;
9
23
  if (/[\u0000-\u0006\u000e-\u001f]/.exec(properties.msgid)) {
10
24
  throw new Error(gtx._('msgid must not contain control characters.'));
@@ -24,58 +38,64 @@ var POTEntry = (function () {
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
  }
33
- POTEntry.build = function () {
34
- var entry = new POTEntry({ msgid: 'ignore' });
35
- delete entry.properties.msgid;
50
+ static build() {
51
+ const entry = new POTEntry({ msgid: 'ignore' });
52
+ entry.properties.msgid = undefined;
36
53
  return entry;
37
- };
38
- POTEntry.prototype.toString = function (width) {
39
- if (width === void 0) { width = 76; }
40
- var out = '';
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
+ */
63
+ toString(width = 76) {
64
+ let out = '';
41
65
  if (typeof this.properties.translatorComments !== 'undefined') {
42
- for (var _i = 0, _a = this.properties.translatorComments; _i < _a.length; _i++) {
43
- var comment = _a[_i];
66
+ for (let comment of this.properties.translatorComments) {
44
67
  comment = comment.replace(/\n/g, '\n# ');
45
- out += "# ".concat(comment, "\n");
68
+ out += `# ${comment}\n`;
46
69
  }
47
70
  }
48
71
  if (typeof this.properties.extractedComments !== 'undefined') {
49
- for (var _b = 0, _c = this.properties.extractedComments; _b < _c.length; _b++) {
50
- var comment = _c[_b];
72
+ for (let comment of this.properties.extractedComments) {
51
73
  comment = comment.replace(/\n/g, '\n#. ');
52
- out += "#. ".concat(comment, "\n");
74
+ out += `#. ${comment}\n`;
53
75
  }
54
76
  }
55
77
  if (typeof this.properties.automatic !== 'undefined') {
56
- for (var _d = 0, _e = this.properties.automatic; _d < _e.length; _d++) {
57
- var comment = _e[_d];
78
+ for (let comment of this.properties.automatic) {
58
79
  comment = comment.replace(/\n/g, '\n#. ');
59
- out += "#. ".concat(comment, "\n");
80
+ out += `#. ${comment}\n`;
60
81
  }
61
82
  }
62
83
  if (typeof this.properties.references !== 'undefined') {
63
- var references = Array.from(new Set(this.properties.references)).join(' ');
84
+ const references = Array.from(new Set(this.properties.references)).join(' ');
64
85
  if (width > 0) {
65
- var wrapped = this.wrap(references, width - 3);
66
- for (var _f = 0, wrapped_1 = wrapped; _f < wrapped_1.length; _f++) {
67
- var line = wrapped_1[_f];
68
- out += "#: ".concat(line.trimRight().replace(/ $/, ''), "\n");
86
+ const wrapped = this.wrap(references, width - 3);
87
+ for (const line of wrapped) {
88
+ out += `#: ${line.trimRight().replace(/ $/, '')}\n`;
69
89
  }
70
90
  }
71
91
  else {
72
- out += "#: ".concat(references, "\n");
92
+ out += `#: ${references}\n`;
73
93
  }
74
94
  }
75
95
  if (typeof this.properties.flags !== 'undefined' &&
76
96
  this.properties.flags.length) {
77
- var flags = Array.from(new Set(this.properties.flags)).join(', ');
78
- out += "#, ".concat(flags, "\n");
97
+ const flags = Array.from(new Set(this.properties.flags)).join(', ');
98
+ out += `#, ${flags}\n`;
79
99
  }
80
100
  if (typeof this.properties.msgctxt !== 'undefined') {
81
101
  out +=
@@ -97,136 +117,178 @@ var POTEntry = (function () {
97
117
  out += 'msgstr[0] ""\nmsgstr[1] ""\n';
98
118
  }
99
119
  return out;
100
- };
101
- POTEntry.prototype.merge = function (other) {
102
- var _a, _b, _c, _d;
103
- var _this = this;
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
+ */
127
+ merge(other) {
104
128
  if (other.properties.translatorComments) {
105
129
  if (!this.properties.translatorComments) {
106
130
  this.properties.translatorComments = new Array();
107
131
  }
108
- (_a = this.properties.translatorComments).push.apply(_a, other.properties.translatorComments);
132
+ this.properties.translatorComments.push(...other.properties.translatorComments);
109
133
  }
110
134
  if (other.properties.automatic) {
111
135
  if (!this.properties.automatic) {
112
136
  this.properties.automatic = new Array();
113
137
  }
114
- (_b = this.properties.automatic).push.apply(_b, other.properties.automatic);
138
+ this.properties.automatic.push(...other.properties.automatic);
115
139
  }
116
140
  if (other.properties.flags) {
117
141
  if (!this.properties.flags) {
118
142
  this.properties.flags = new Array();
119
143
  }
120
- other.properties.flags.forEach(function (flag) {
121
- var negated = flag.replace(/^no-/, '');
144
+ other.properties.flags.forEach(flag => {
145
+ let negated = flag.replace(/^no-/, '');
122
146
  if (negated === flag) {
123
147
  negated = 'no-' + flag;
124
148
  }
125
- if (_this.properties.flags.includes(negated)) {
149
+ if (this.properties.flags.includes(negated)) {
126
150
  other.warning(gtx._x('flag "{flag}" conflicts with previous flag "{negated}"', {
127
- flag: flag,
128
- negated: negated,
151
+ flag,
152
+ negated,
129
153
  }));
130
- var refs = _this.properties.references;
154
+ const refs = this.properties.references;
131
155
  if (refs) {
132
- other.warning(gtx._nx('The conflicting flag "{negated}" may stem from this location:', 'The conflicting flag "{negated}" may stem from one of these locations:', refs.length, { flag: flag, negated: negated }));
133
- refs.forEach(function (ref) {
134
- console.warn("\t".concat(ref));
156
+ other.warning(gtx._nx('The conflicting flag "{negated}" may stem from this location:', 'The conflicting flag "{negated}" may stem from one of these locations:', refs.length, { flag, negated }));
157
+ refs.forEach(ref => {
158
+ console.warn(`\t${ref}`);
135
159
  });
136
160
  }
137
161
  }
138
162
  });
139
- (_c = this.properties.flags).push.apply(_c, other.properties.flags);
163
+ this.properties.flags.push(...other.properties.flags);
140
164
  }
141
165
  if (other.properties.references) {
142
166
  if (!this.properties.references) {
143
167
  this.properties.references = new Array();
144
168
  }
145
- (_d = this.properties.references).push.apply(_d, other.properties.references);
169
+ this.properties.references.push(...other.properties.references);
146
170
  }
147
- };
148
- POTEntry.prototype.addExtractedCommentLine = function (line) {
171
+ }
172
+ /**
173
+ * Add an extracted comment line. These are comments starting with "#.".
174
+ *
175
+ * @param line - one comment line to add
176
+ */
177
+ addExtractedCommentLine(line) {
149
178
  if (!this.properties.extractedComments) {
150
179
  this.properties.extractedComments = [];
151
180
  }
152
181
  this.properties.extractedComments.push(line);
153
- };
154
- POTEntry.prototype.addTranslatorCommentLine = function (line) {
182
+ }
183
+ /**
184
+ * Add a normal comment line.
185
+ *
186
+ * @param line - one comment line to add
187
+ */
188
+ addTranslatorCommentLine(line) {
155
189
  if (!this.properties.translatorComments) {
156
190
  this.properties.translatorComments = [];
157
191
  }
158
192
  this.properties.translatorComments.push(line);
159
- };
160
- POTEntry.prototype.addFlag = function (flag) {
193
+ }
194
+ /**
195
+ * Add a flag.
196
+ *
197
+ * @param flags - the flag to add
198
+ */
199
+ addFlag(flag) {
161
200
  if (!this.properties.flags) {
162
201
  this.properties.flags = [];
163
202
  }
164
203
  this.properties.flags.push(flag);
165
- };
166
- POTEntry.prototype.addReference = function (reference) {
204
+ }
205
+ /**
206
+ * Add a reference.
207
+ *
208
+ * @param reference - the reference to add
209
+ */
210
+ addReference(reference) {
167
211
  if (!this.properties.references) {
168
212
  this.properties.references = [];
169
213
  }
170
214
  this.properties.references.push(reference);
171
- };
172
- POTEntry.prototype.addToMsgid = function (chunk) {
215
+ }
216
+ /**
217
+ * Add a string chunk to the msgid.
218
+ *
219
+ * @param chunk - the chunk to add
220
+ */
221
+ addToMsgid(chunk) {
173
222
  if (typeof this.properties.msgid === 'undefined') {
174
223
  this.properties.msgid = '';
175
224
  }
176
225
  this.properties.msgid += chunk;
177
- };
178
- POTEntry.prototype.addToMsgidPlural = function (chunk) {
226
+ }
227
+ /**
228
+ * Add a string chunk to the msgid_plural.
229
+ *
230
+ * @param chunk - the chunk to add
231
+ */
232
+ addToMsgidPlural(chunk) {
179
233
  if (typeof this.properties.msgidPlural === 'undefined') {
180
234
  this.properties.msgidPlural = '';
181
235
  }
182
236
  this.properties.msgidPlural += chunk;
183
- };
184
- POTEntry.prototype.addToMsgstr = function (chunk) {
237
+ }
238
+ /**
239
+ * Add a string chunk to the msgstr.
240
+ *
241
+ * @param chunk - the chunk to add
242
+ */
243
+ addToMsgstr(chunk) {
185
244
  if (typeof this.properties.msgstr === 'undefined') {
186
245
  this.properties.msgstr = '';
187
246
  }
188
247
  this.properties.msgstr += chunk;
189
- };
190
- POTEntry.prototype.addToMsgctxt = function (chunk) {
248
+ }
249
+ /**
250
+ * Add a string chunk to the msgctxt.
251
+ *
252
+ * @param chunk - the chunk to add
253
+ */
254
+ addToMsgctxt(chunk) {
191
255
  if (typeof this.properties.msgctxt === 'undefined') {
192
256
  this.properties.msgctxt = '';
193
257
  }
194
258
  this.properties.msgctxt += chunk;
195
- };
196
- POTEntry.prototype.serializeMsgId = function (input, width, prefix) {
197
- var _this = this;
198
- if (prefix === void 0) { prefix = 'msgid'; }
259
+ }
260
+ serializeMsgId(input, width, prefix = 'msgid') {
199
261
  if (width <= 0) {
200
- var escaped = this.escape(input);
201
- return "".concat(prefix, " \"").concat(escaped, "\"");
262
+ const escaped = this.escape(input);
263
+ return `${prefix} "${escaped}"`;
202
264
  }
203
- var output = new Array();
204
- var preWrapped = input.split('\n').map(function (str) { return _this.escape(str); });
265
+ const output = new Array();
266
+ const preWrapped = input.split('\n').map(str => this.escape(str));
205
267
  if (preWrapped.length > 1 ||
206
268
  preWrapped[0].length > width - prefix.length - 3) {
207
- output.push("".concat(prefix, " \"\""));
269
+ output.push(`${prefix} ""`);
208
270
  }
209
271
  else {
210
- var chunk = preWrapped.shift();
211
- output.push("".concat(prefix, " \"").concat(chunk, "\""));
272
+ const chunk = preWrapped.shift();
273
+ output.push(`${prefix} "${chunk}"`);
212
274
  }
213
- preWrapped.forEach(function (line, index) {
275
+ preWrapped.forEach((line, index) => {
214
276
  if (index < preWrapped.length - 1) {
215
277
  line += '\\n';
216
278
  }
217
279
  if (line.length) {
218
- var wrapped = _this.wrap(line, width - 2);
219
- wrapped.forEach(function (inner) {
220
- output.push("\"".concat(inner, "\""));
280
+ const wrapped = this.wrap(line, width - 2);
281
+ wrapped.forEach(inner => {
282
+ output.push(`"${inner}"`);
221
283
  });
222
284
  }
223
285
  });
224
286
  return output.join('\n');
225
- };
226
- POTEntry.prototype.wrap = function (input, width) {
227
- var output = new Array();
287
+ }
288
+ wrap(input, width) {
289
+ const output = new Array();
228
290
  while (input.length > width) {
229
- var i = input.lastIndexOf(' ', width);
291
+ let i = input.lastIndexOf(' ', width);
230
292
  if (i < 0) {
231
293
  i = input.indexOf(' ', width);
232
294
  }
@@ -238,9 +300,9 @@ var POTEntry = (function () {
238
300
  }
239
301
  output.push(input);
240
302
  return output;
241
- };
242
- POTEntry.prototype.escape = function (input) {
243
- var escapes = {
303
+ }
304
+ escape(input) {
305
+ const escapes = {
244
306
  '\u0007': '\\a',
245
307
  '\b': '\\b',
246
308
  '\t': '\\t',
@@ -251,72 +313,68 @@ var POTEntry = (function () {
251
313
  '"': '\\"',
252
314
  '\\': '\\\\',
253
315
  };
254
- return input.replace(/([\u0007-\u000d"\\])/gs, function (m) {
316
+ return input.replace(/([\u0007-\u000d"\\])/gs, m => {
255
317
  return escapes[m[0]];
256
318
  });
257
- };
258
- POTEntry.prototype.checkDeprecatedControls = function (str) {
319
+ }
320
+ checkDeprecatedControls(str) {
259
321
  if (typeof str === 'undefined') {
260
322
  return;
261
323
  }
262
- var deprecated = RegExp('[\u0007\u0008\u000b-\u000e]', 'gs');
263
- var escapes = {
324
+ const deprecated = RegExp('[\u0007\u0008\u000b-\u000e]', 'gs');
325
+ const escapes = {
264
326
  '\u0007': '\\a',
265
327
  '\b': '\\b',
266
328
  '\v': '\\v',
267
329
  '\f': '\\f',
268
330
  '\r': '\\r',
269
331
  };
270
- var matches;
332
+ let matches;
271
333
  while ((matches = deprecated.exec(str)) !== null) {
272
- var escape_1 = escapes[matches[0]];
273
- if (!escape_1) {
334
+ const escape = escapes[matches[0]];
335
+ if (!escape) {
274
336
  continue;
275
337
  }
276
338
  delete escapes[matches[0]];
277
339
  this.warning(gtx._x('internationalized messages should not ' +
278
- "contain the '{escape}' escape sequence", { escape: escape_1 }));
340
+ "contain the '{escape}' escape sequence", { escape }));
279
341
  }
280
- };
281
- POTEntry.prototype.checkReferences = function () {
282
- var _this = this;
342
+ }
343
+ checkReferences() {
283
344
  if (typeof this.properties.references === 'undefined') {
284
345
  return;
285
346
  }
286
- this.properties.references.forEach(function (ref) {
347
+ this.properties.references.forEach(ref => {
287
348
  if (/[ \n]/.exec(ref)) {
288
- _this.error(gtx._('filenames must not contain space or newlines'));
349
+ this.error(gtx._('filenames must not contain space or newlines'));
289
350
  }
290
351
  });
291
- };
292
- POTEntry.prototype.checkFlags = function () {
293
- var _this = this;
352
+ }
353
+ checkFlags() {
294
354
  if (typeof this.properties.flags === 'undefined') {
295
355
  return;
296
356
  }
297
- this.properties.flags.forEach(function (flag) {
357
+ this.properties.flags.forEach(flag => {
298
358
  if (/[,\n]/.exec(flag)) {
299
- _this.error(gtx._('flags must not contain commas or newlines'));
359
+ this.error(gtx._('flags must not contain commas or newlines'));
300
360
  }
301
361
  });
302
- };
303
- POTEntry.prototype.error = function (msg) {
304
- var location = gtx._('[in memory]');
362
+ }
363
+ error(msg) {
364
+ let location = gtx._('[in memory]');
305
365
  if (typeof this.properties.references !== 'undefined') {
306
366
  location = this.properties.references[0].toString();
307
367
  }
308
- throw new Error(gtx._x('{location}: error: {msg}', { location: location, msg: msg }));
309
- };
310
- POTEntry.prototype.warning = function (msg) {
368
+ throw new Error(gtx._x('{location}: error: {msg}', { location, msg }));
369
+ }
370
+ warning(msg) {
311
371
  if (!this.properties.noWarnings) {
312
- var location_1 = gtx._('[in memory]');
372
+ let location = gtx._('[in memory]');
313
373
  if (typeof this.properties.references !== 'undefined') {
314
- location_1 = this.properties.references[0].toString();
374
+ location = this.properties.references[0].toString();
315
375
  }
316
- console.warn(gtx._x('{location}: warning: {msg}', { location: location_1, msg: msg }));
376
+ console.warn(gtx._x('{location}: warning: {msg}', { location, msg }));
317
377
  }
318
- };
319
- return POTEntry;
320
- }());
378
+ }
379
+ }
321
380
  exports.POTEntry = POTEntry;
322
- //# sourceMappingURL=entry.js.map