@gjsify/vite-plugin-gettext 0.2.1 → 0.2.3

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 CHANGED
@@ -44,6 +44,11 @@ export default defineConfig({
44
44
  output: "po/messages.pot",
45
45
  domain: "myapp",
46
46
  keywords: ["_", "gettext", "ngettext"],
47
+ // Stabilize POT output for CI and avoid noisy diffs
48
+ noLocation: true,
49
+ deterministic: true,
50
+ sourceDateEpoch: 0,
51
+ sortOutput: true,
47
52
  verbose: true,
48
53
  }),
49
54
  // Compile PO files to MO format (standard approach)
@@ -94,6 +99,12 @@ export default defineConfig({
94
99
  - `keywords`: Keywords to look for when extracting strings (defaults to ['_', 'gettext', 'ngettext'])
95
100
  - `xgettextOptions`: Additional options to pass to xgettext command
96
101
  - `verbose`: Enable verbose logging
102
+ - `msgcatOptions`: Additional options to pass to msgcat when combining POT files
103
+ - `noLocation`: If true, omit source reference locations from POT/PO (passes `--no-location`)
104
+ - `deterministic`: If true, enable reproducible output (sets `SOURCE_DATE_EPOCH` and stable headers)
105
+ - `sourceDateEpoch`: Epoch seconds for reproducible timestamps (default: 0)
106
+ - `fixedCreationDate`: Force a fixed `POT-Creation-Date` header string
107
+ - `sortOutput`: Sort output messages for stable diffs (passes `--sort-output` to msgcat)
97
108
 
98
109
  ### gettextPlugin Options
99
110
 
package/dist/types.d.ts CHANGED
@@ -13,6 +13,8 @@ export interface XGettextPluginOptions {
13
13
  keywords?: string[];
14
14
  /** Additional options to pass to xgettext command */
15
15
  xgettextOptions?: string[];
16
+ /** Additional options to pass to msgcat when combining POT files */
17
+ msgcatOptions?: string[];
16
18
  /** Enable verbose logging */
17
19
  verbose?: boolean;
18
20
  /** Automatically update PO files after POT changes */
@@ -25,6 +27,16 @@ export interface XGettextPluginOptions {
25
27
  msgidBugsAddress?: string;
26
28
  /** Copyright holder to set in the POT file */
27
29
  copyrightHolder?: string;
30
+ /** If true, do not include source reference locations in POT/PO files */
31
+ noLocation?: boolean;
32
+ /** If true, attempt to make output reproducible (stable timestamps/order) */
33
+ deterministic?: boolean;
34
+ /** When deterministic is true, use this SOURCE_DATE_EPOCH (seconds since epoch). Defaults to 0. */
35
+ sourceDateEpoch?: number;
36
+ /** Optionally force a fixed POT-Creation-Date header value (e.g. '1970-01-01 00:00+0000') */
37
+ fixedCreationDate?: string;
38
+ /** If true, sort the output messages for stable diffs (passed to msgcat) */
39
+ sortOutput?: boolean;
28
40
  }
29
41
  /**
30
42
  * Configuration options for the gettext plugin
package/dist/xgettext.js CHANGED
@@ -138,6 +138,9 @@ async function extractStrings(files, options, pluginName) {
138
138
  "--from-code=UTF-8",
139
139
  "--add-comments",
140
140
  ];
141
+ if (options.noLocation) {
142
+ args.push("--no-location");
143
+ }
141
144
  // Add bug report address if specified
142
145
  if (options.msgidBugsAddress) {
143
146
  args.push("--msgid-bugs-address=" + options.msgidBugsAddress);
@@ -174,10 +177,22 @@ async function extractStrings(files, options, pluginName) {
174
177
  args.push("--language=Desktop");
175
178
  break;
176
179
  }
180
+ // Allow custom xgettext options
181
+ if (options.xgettextOptions && options.xgettextOptions.length > 0) {
182
+ args.push(...options.xgettextOptions);
183
+ }
177
184
  if (verbose) {
178
185
  console.log(`[${pluginName}] Running xgettext for ${group}:`, args.join(" "));
179
186
  }
180
- await execa("xgettext", args);
187
+ // Enforce deterministic timestamps if requested
188
+ const env = { ...process.env };
189
+ if (options.deterministic) {
190
+ const epoch = typeof options.sourceDateEpoch === "number"
191
+ ? options.sourceDateEpoch
192
+ : 0;
193
+ env.SOURCE_DATE_EPOCH = String(epoch);
194
+ }
195
+ await execa("xgettext", args, { env });
181
196
  // Check if file exists before adding to tempPotFiles
182
197
  try {
183
198
  await fs.access(tempOutput);
@@ -192,8 +207,25 @@ async function extractStrings(files, options, pluginName) {
192
207
  }
193
208
  // Combine all temporary POT files using msgcat
194
209
  if (tempPotFiles.length > 0) {
195
- const msgcatArgs = ["--use-first", "-o", output, ...tempPotFiles];
196
- await execa("msgcat", msgcatArgs);
210
+ const msgcatArgs = ["--use-first"];
211
+ if (options.noLocation) {
212
+ msgcatArgs.push("--no-location");
213
+ }
214
+ if (options.sortOutput) {
215
+ msgcatArgs.push("--sort-output");
216
+ }
217
+ if (options.msgcatOptions && options.msgcatOptions.length > 0) {
218
+ msgcatArgs.push(...options.msgcatOptions);
219
+ }
220
+ msgcatArgs.push("-o", output, ...tempPotFiles);
221
+ const env = { ...process.env };
222
+ if (options.deterministic) {
223
+ const epoch = typeof options.sourceDateEpoch === "number"
224
+ ? options.sourceDateEpoch
225
+ : 0;
226
+ env.SOURCE_DATE_EPOCH = String(epoch);
227
+ }
228
+ await execa("msgcat", msgcatArgs, { env });
197
229
  // Clean up temporary files
198
230
  for (const tempFile of tempPotFiles) {
199
231
  await fs.unlink(tempFile);
@@ -202,15 +234,36 @@ async function extractStrings(files, options, pluginName) {
202
234
  await fs.unlink(potFile);
203
235
  }
204
236
  }
237
+ // Optionally normalize POT-Creation-Date header to a fixed value
238
+ if (options.fixedCreationDate || options.deterministic) {
239
+ try {
240
+ const normalizedDate = options.fixedCreationDate
241
+ ? options.fixedCreationDate
242
+ : formatSourceDateEpoch(typeof options.sourceDateEpoch === "number"
243
+ ? options.sourceDateEpoch
244
+ : 0);
245
+ const content = await fs.readFile(output, "utf-8");
246
+ const replaced = content.replace(/^"POT-Creation-Date: .*\\n"$/m, `"POT-Creation-Date: ${normalizedDate}\\n"`);
247
+ if (replaced !== content) {
248
+ await fs.writeFile(output, replaced);
249
+ if (verbose) {
250
+ console.log(`[${pluginName}] Normalized POT-Creation-Date to '${normalizedDate}'`);
251
+ }
252
+ }
253
+ }
254
+ catch (e) {
255
+ console.warn(`[${pluginName}] Failed to normalize POT-Creation-Date header:`, e);
256
+ }
257
+ }
205
258
  if (options.autoUpdatePo) {
206
- await updatePoFiles(options.output, pluginName, options.verbose || false);
259
+ await updatePoFiles(options.output, pluginName, options.verbose || false, options);
207
260
  }
208
261
  }
209
262
  catch (error) {
210
263
  throw new Error(`Failed to extract translations: ${error}`);
211
264
  }
212
265
  }
213
- async function updatePoFiles(potFile, pluginName, verbose) {
266
+ async function updatePoFiles(potFile, pluginName, verbose, options) {
214
267
  try {
215
268
  const linguasPath = path.join(path.dirname(potFile), "LINGUAS");
216
269
  const languages = (await fs.readFile(linguasPath, "utf-8"))
@@ -221,13 +274,38 @@ async function updatePoFiles(potFile, pluginName, verbose) {
221
274
  if (verbose) {
222
275
  console.log(`[${pluginName}] Updating ${poFile}`);
223
276
  }
224
- await execa("msgmerge", ["--update", "--backup=none", poFile, potFile]);
277
+ const args = ["--update", "--backup=none"];
278
+ if (options.noLocation) {
279
+ args.push("--no-location");
280
+ }
281
+ const env = { ...process.env };
282
+ if (options.deterministic) {
283
+ const epoch = typeof options.sourceDateEpoch === "number"
284
+ ? options.sourceDateEpoch
285
+ : 0;
286
+ env.SOURCE_DATE_EPOCH = String(epoch);
287
+ }
288
+ await execa("msgmerge", [...args, poFile, potFile], { env });
225
289
  }
226
290
  }
227
291
  catch (error) {
228
292
  console.error(`[${pluginName}] Error updating PO files:`, error);
229
293
  }
230
294
  }
295
+ /**
296
+ * Formats a date in gettext header format using an epoch (seconds) in UTC timezone
297
+ * Example output: 1970-01-01 00:00+0000
298
+ */
299
+ function formatSourceDateEpoch(epochSeconds) {
300
+ const date = new Date(epochSeconds * 1000);
301
+ const pad = (n) => String(n).padStart(2, "0");
302
+ const year = date.getUTCFullYear();
303
+ const month = pad(date.getUTCMonth() + 1);
304
+ const day = pad(date.getUTCDate());
305
+ const hours = pad(date.getUTCHours());
306
+ const minutes = pad(date.getUTCMinutes());
307
+ return `${year}-${month}-${day} ${hours}:${minutes}+0000`;
308
+ }
231
309
  /**
232
310
  * Finds the first existing metainfo.its file from installed gettext versions
233
311
  * @returns The path to the metainfo.its file if found, otherwise undefined
@@ -1 +1 @@
1
- {"version":3,"file":"xgettext.js","sourceRoot":"","sources":["../src/xgettext.ts"],"names":[],"mappings":"AAAA,OAA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;AAED;;;GAGG;AACH,KAAK,UAAU,mBAAmB;IAChC,eAAe;IACf,MAAM,WAAW,GAAG,qCAAqC,CAAC;IAE1D,2BAA2B;IAC3B,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,CAAC;QACH,6DAA6D;QAC7D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAEvD,6CAA6C;QAC7C,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;YACtD,MAAM,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;YACtD,OAAO,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,2CAA2C;QAC3C,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,CACtC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,mBAAmB,CACnC,CAAC;QAEF,2BAA2B;QAC3B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@gjsify/vite-plugin-gettext",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Vite plugin for compiling Gettext PO files",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
8
+ "test": "echo \"Warning: no test specified\" && exit 0",
9
9
  "clear": "rm -rf dist",
10
10
  "check": "tsc --noEmit",
11
11
  "build": "tsc --declaration"
package/src/types.ts CHANGED
@@ -13,6 +13,8 @@ export interface XGettextPluginOptions {
13
13
  keywords?: string[];
14
14
  /** Additional options to pass to xgettext command */
15
15
  xgettextOptions?: string[];
16
+ /** Additional options to pass to msgcat when combining POT files */
17
+ msgcatOptions?: string[];
16
18
  /** Enable verbose logging */
17
19
  verbose?: boolean;
18
20
  /** Automatically update PO files after POT changes */
@@ -25,6 +27,16 @@ export interface XGettextPluginOptions {
25
27
  msgidBugsAddress?: string;
26
28
  /** Copyright holder to set in the POT file */
27
29
  copyrightHolder?: string;
30
+ /** If true, do not include source reference locations in POT/PO files */
31
+ noLocation?: boolean;
32
+ /** If true, attempt to make output reproducible (stable timestamps/order) */
33
+ deterministic?: boolean;
34
+ /** When deterministic is true, use this SOURCE_DATE_EPOCH (seconds since epoch). Defaults to 0. */
35
+ sourceDateEpoch?: number;
36
+ /** Optionally force a fixed POT-Creation-Date header value (e.g. '1970-01-01 00:00+0000') */
37
+ fixedCreationDate?: string;
38
+ /** If true, sort the output messages for stable diffs (passed to msgcat) */
39
+ sortOutput?: boolean;
28
40
  }
29
41
 
30
42
  /**
package/src/xgettext.ts CHANGED
@@ -188,6 +188,10 @@ async function extractStrings(
188
188
  "--add-comments",
189
189
  ];
190
190
 
191
+ if (options.noLocation) {
192
+ args.push("--no-location");
193
+ }
194
+
191
195
  // Add bug report address if specified
192
196
  if (options.msgidBugsAddress) {
193
197
  args.push("--msgid-bugs-address=" + options.msgidBugsAddress);
@@ -229,6 +233,11 @@ async function extractStrings(
229
233
  break;
230
234
  }
231
235
 
236
+ // Allow custom xgettext options
237
+ if (options.xgettextOptions && options.xgettextOptions.length > 0) {
238
+ args.push(...options.xgettextOptions);
239
+ }
240
+
232
241
  if (verbose) {
233
242
  console.log(
234
243
  `[${pluginName}] Running xgettext for ${group}:`,
@@ -236,7 +245,17 @@ async function extractStrings(
236
245
  );
237
246
  }
238
247
 
239
- await execa("xgettext", args);
248
+ // Enforce deterministic timestamps if requested
249
+ const env = { ...process.env };
250
+ if (options.deterministic) {
251
+ const epoch =
252
+ typeof options.sourceDateEpoch === "number"
253
+ ? options.sourceDateEpoch
254
+ : 0;
255
+ env.SOURCE_DATE_EPOCH = String(epoch);
256
+ }
257
+
258
+ await execa("xgettext", args, { env });
240
259
 
241
260
  // Check if file exists before adding to tempPotFiles
242
261
  try {
@@ -256,8 +275,28 @@ async function extractStrings(
256
275
 
257
276
  // Combine all temporary POT files using msgcat
258
277
  if (tempPotFiles.length > 0) {
259
- const msgcatArgs = ["--use-first", "-o", output, ...tempPotFiles];
260
- await execa("msgcat", msgcatArgs);
278
+ const msgcatArgs = ["--use-first"];
279
+ if (options.noLocation) {
280
+ msgcatArgs.push("--no-location");
281
+ }
282
+ if (options.sortOutput) {
283
+ msgcatArgs.push("--sort-output");
284
+ }
285
+ if (options.msgcatOptions && options.msgcatOptions.length > 0) {
286
+ msgcatArgs.push(...options.msgcatOptions);
287
+ }
288
+ msgcatArgs.push("-o", output, ...tempPotFiles);
289
+
290
+ const env = { ...process.env };
291
+ if (options.deterministic) {
292
+ const epoch =
293
+ typeof options.sourceDateEpoch === "number"
294
+ ? options.sourceDateEpoch
295
+ : 0;
296
+ env.SOURCE_DATE_EPOCH = String(epoch);
297
+ }
298
+
299
+ await execa("msgcat", msgcatArgs, { env });
261
300
 
262
301
  // Clean up temporary files
263
302
  for (const tempFile of tempPotFiles) {
@@ -268,8 +307,44 @@ async function extractStrings(
268
307
  }
269
308
  }
270
309
 
310
+ // Optionally normalize POT-Creation-Date header to a fixed value
311
+ if (options.fixedCreationDate || options.deterministic) {
312
+ try {
313
+ const normalizedDate = options.fixedCreationDate
314
+ ? options.fixedCreationDate
315
+ : formatSourceDateEpoch(
316
+ typeof options.sourceDateEpoch === "number"
317
+ ? options.sourceDateEpoch
318
+ : 0
319
+ );
320
+ const content = await fs.readFile(output, "utf-8");
321
+ const replaced = content.replace(
322
+ /^"POT-Creation-Date: .*\\n"$/m,
323
+ `"POT-Creation-Date: ${normalizedDate}\\n"`
324
+ );
325
+ if (replaced !== content) {
326
+ await fs.writeFile(output, replaced);
327
+ if (verbose) {
328
+ console.log(
329
+ `[${pluginName}] Normalized POT-Creation-Date to '${normalizedDate}'`
330
+ );
331
+ }
332
+ }
333
+ } catch (e) {
334
+ console.warn(
335
+ `[${pluginName}] Failed to normalize POT-Creation-Date header:`,
336
+ e
337
+ );
338
+ }
339
+ }
340
+
271
341
  if (options.autoUpdatePo) {
272
- await updatePoFiles(options.output, pluginName, options.verbose || false);
342
+ await updatePoFiles(
343
+ options.output,
344
+ pluginName,
345
+ options.verbose || false,
346
+ options
347
+ );
273
348
  }
274
349
  } catch (error) {
275
350
  throw new Error(`Failed to extract translations: ${error}`);
@@ -279,7 +354,8 @@ async function extractStrings(
279
354
  async function updatePoFiles(
280
355
  potFile: string,
281
356
  pluginName: string,
282
- verbose: boolean
357
+ verbose: boolean,
358
+ options: XGettextPluginOptions
283
359
  ) {
284
360
  try {
285
361
  const linguasPath = path.join(path.dirname(potFile), "LINGUAS");
@@ -292,13 +368,42 @@ async function updatePoFiles(
292
368
  if (verbose) {
293
369
  console.log(`[${pluginName}] Updating ${poFile}`);
294
370
  }
295
- await execa("msgmerge", ["--update", "--backup=none", poFile, potFile]);
371
+ const args = ["--update", "--backup=none"] as string[];
372
+ if (options.noLocation) {
373
+ args.push("--no-location");
374
+ }
375
+
376
+ const env = { ...process.env };
377
+ if (options.deterministic) {
378
+ const epoch =
379
+ typeof options.sourceDateEpoch === "number"
380
+ ? options.sourceDateEpoch
381
+ : 0;
382
+ env.SOURCE_DATE_EPOCH = String(epoch);
383
+ }
384
+
385
+ await execa("msgmerge", [...args, poFile, potFile], { env });
296
386
  }
297
387
  } catch (error) {
298
388
  console.error(`[${pluginName}] Error updating PO files:`, error);
299
389
  }
300
390
  }
301
391
 
392
+ /**
393
+ * Formats a date in gettext header format using an epoch (seconds) in UTC timezone
394
+ * Example output: 1970-01-01 00:00+0000
395
+ */
396
+ function formatSourceDateEpoch(epochSeconds: number): string {
397
+ const date = new Date(epochSeconds * 1000);
398
+ const pad = (n: number) => String(n).padStart(2, "0");
399
+ const year = date.getUTCFullYear();
400
+ const month = pad(date.getUTCMonth() + 1);
401
+ const day = pad(date.getUTCDate());
402
+ const hours = pad(date.getUTCHours());
403
+ const minutes = pad(date.getUTCMinutes());
404
+ return `${year}-${month}-${day} ${hours}:${minutes}+0000`;
405
+ }
406
+
302
407
  /**
303
408
  * Finds the first existing metainfo.its file from installed gettext versions
304
409
  * @returns The path to the metainfo.its file if found, otherwise undefined