@gjsify/vite-plugin-gettext 0.64.60-next.368 → 0.64.61-next.371

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/lib/xgettext.js CHANGED
@@ -2,6 +2,7 @@ import { execa } from 'execa';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs/promises';
4
4
  import { existsSync } from 'node:fs';
5
+ import { fileURLToPath } from 'node:url';
5
6
  import glob from 'fast-glob';
6
7
  import { activeMsgids, assertCatalogsSurviveMerge, assertEverySourcePatternMatched, EmptySourcePatternError, GettextGuardError, } from './guards.js';
7
8
  import { checkDependencies, ensureDirectory, processFilename } from './utils.js';
@@ -260,6 +261,15 @@ async function extractStrings(files, options, pluginName) {
260
261
  else {
261
262
  baseArgs.push(`--its=${metainfoItsPath}`);
262
263
  }
264
+ // Always, even when the stock file is missing: the stock rules never mark
265
+ // `<custom><value>` translatable (ADR 0153's disclosure sentence).
266
+ {
267
+ const customItsPath = findCustomItsPath();
268
+ if (customItsPath)
269
+ baseArgs.push(`--its=${customItsPath}`);
270
+ else
271
+ console.warn('Warning: metainfo-custom.its is missing from @gjsify/vite-plugin-gettext');
272
+ }
263
273
  break;
264
274
  case 'desktop':
265
275
  baseArgs.push('--language=Desktop');
@@ -494,3 +504,12 @@ async function findMetainfoItsPath() {
494
504
  return undefined;
495
505
  }
496
506
  }
507
+ /**
508
+ * The ITS file shipped next to `lib/` that marks `gjsify::ai-disclosure` translatable.
509
+ * Looked up beside the module and one level up: `lib/xgettext.js` in the package, but a
510
+ * bundled test or consumer sits at the package root or elsewhere.
511
+ */
512
+ function findCustomItsPath() {
513
+ const here = path.dirname(fileURLToPath(import.meta.url));
514
+ return [path.join(here, 'metainfo-custom.its'), path.join(here, '..', 'metainfo-custom.its')].find((p) => existsSync(p));
515
+ }
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ GNU gettext's stock metainfo.its (Copyright (C) 2015-2024 Matthias Klumpp, (C) 2019 Takao Fujiwara,
4
+ SPDX-License-Identifier: FSFAP) plus one rule for ADR 0153.
5
+
6
+ The stock file marks no <custom><value> translatable, so the AI disclosure sentence never reaches
7
+ the POT. A second its file is NOT additive: xgettext lets the LAST file decide every node, so a
8
+ file holding only the new rule makes everything translatable and one that sets the root to
9
+ translate="no" silences name and summary. This file therefore repeats the stock rules in full and
10
+ is passed LAST. Re-sync it when gettext's metainfo.its changes.
11
+ -->
12
+ <its:rules xmlns:its="http://www.w3.org/2005/11/its"
13
+ version="2.0">
14
+
15
+ <its:translateRule selector="/component" translate="no"/>
16
+ <its:translateRule selector="/component/name |
17
+ /component/summary |
18
+ /component/description |
19
+ /component/developer_name |
20
+ /component/developer/name |
21
+ /component/name_variant_suffix |
22
+ /component/keywords/keyword |
23
+ /component/screenshots/screenshot/caption |
24
+ /component/releases/release/description |
25
+ /component/agreement/agreement_section/name |
26
+ /component/agreement/agreement_section/description"
27
+ translate="yes"/>
28
+
29
+ <its:withinTextRule withinText="yes" selector="/component//description//em |
30
+ /component//description//code"/>
31
+
32
+ <its:translateRule selector="/component/name[@translate = 'no']"
33
+ translate="no"/>
34
+ <its:translateRule selector="/component/developer_name[@translate = 'no']"
35
+ translate="no"/>
36
+ <its:translateRule selector="/component/developer/name[@translate = 'no']"
37
+ translate="no"/>
38
+ <its:translateRule selector="/component/name_variant_suffix[@translate = 'no']"
39
+ translate="no"/>
40
+ <its:translateRule selector="/component/keywords/keyword[@translate = 'no']"
41
+ translate="no"/>
42
+ <its:translateRule selector="/component/releases/release/description[@translate = 'no']"
43
+ translate="no"/>
44
+ <its:translateRule selector="/component/agreement/agreement_section/name[@translate = 'no'] |
45
+ /component/agreement/agreement_section/description[@translate = 'no']"
46
+ translate="no"/>
47
+
48
+ <!-- Release metadata -->
49
+ <its:translateRule selector="/releases" translate="no"/>
50
+ <its:translateRule selector="/releases/release/description"
51
+ translate="yes"/>
52
+ <its:translateRule selector="/releases/release/description[@translate = 'no']"
53
+ translate="no"/>
54
+
55
+
56
+ <!-- ADR 0153: the AI disclosure sentence is the msgid; the level next to it is not translatable. -->
57
+ <its:translateRule selector="/component/custom/value[@key='gjsify::ai-disclosure']" translate="yes"/>
58
+ <its:translateRule selector="/metainfo:component/metainfo:custom/metainfo:value[@key='gjsify::ai-disclosure']"
59
+ translate="yes" xmlns:metainfo="https://specifications.freedesktop.org/metainfo/1.0"/>
60
+
61
+ </its:rules>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/vite-plugin-gettext",
3
- "version": "0.64.60-next.368",
3
+ "version": "0.64.61-next.371",
4
4
  "description": "Gettext PO/MO/JSON pipeline for Vite / Rollup / Rolldown — extract via xgettext, compile via msgfmt, JSON for browser targets.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -13,7 +13,8 @@
13
13
  }
14
14
  },
15
15
  "files": [
16
- "lib"
16
+ "lib",
17
+ "metainfo-custom.its"
17
18
  ],
18
19
  "scripts": {
19
20
  "clear": "gjsify clear lib tsconfig.tsbuildinfo test.node.mjs",
@@ -59,8 +60,8 @@
59
60
  }
60
61
  },
61
62
  "devDependencies": {
62
- "@gjsify/cli": "0.64.60-next.368",
63
- "@gjsify/unit": "0.64.60-next.368",
63
+ "@gjsify/cli": "0.64.61-next.371",
64
+ "@gjsify/unit": "0.64.61-next.371",
64
65
  "@types/gettext-parser": "^9.0.0",
65
66
  "@types/node": "^25.9.2",
66
67
  "typescript": "^6.0.3",
@@ -69,5 +70,5 @@
69
70
  "gjsify": {
70
71
  "tier": 1
71
72
  },
72
- "gitHead": "bc5216978780476bb76edc9c1a920f5d837590a0"
73
+ "gitHead": "8d5f83c60a8c3d2c03428cdbce40c90ab8a06997"
73
74
  }