Skip to content

chore(i18n): record catalog locations by file, not file:line - #673

Merged
got3nks merged 2 commits into
amule-org:masterfrom
got3nks:chore/po-file-locations
Jul 28, 2026
Merged

chore(i18n): record catalog locations by file, not file:line#673
got3nks merged 2 commits into
amule-org:masterfrom
got3nks:chore/po-file-locations

Conversation

@got3nks

@got3nks got3nks commented Jul 28, 2026

Copy link
Copy Markdown

Why

Every catalog entry carries a #: src/foo.cpp:1234 reference. A line number shifts whenever anything above a string is edited, so on each regen all 41 catalogs rewrite their entire reference block.

Measured on #663: the po/ diff was ~27,000 lines, of which 25,174 were #: renumbering — against 4 msgids of genuine content change (three tooltips from the removed toolbar button, plus "Disconnect Kad"). It also means any two PRs in flight conflict in po/ regardless of what they actually touch — #642, #643, #662, #663 and #664 all hit it.

What

  • scripts/update-po.sh: --add-location=file on both xgettext and msgmerge. The flag is needed on msgmerge too — without it, merging the pot back into each .po re-expands references to full file:line.
  • scripts/update-manpages-po.sh: the po4a counterpart, --porefs file.

References become #: src/amuleDlg.cpp. Translators keep the "where is this string used" context Weblate shows (and repo-browser links still resolve, at file granularity); the renumbering churn goes away.

Scope

Scripts only — no catalogs in this PR. They still hold file:line references and will pick up the new format the next time they are regenerated, so this does not collide with anything in flight.

Verification

  • Ran both scripts locally: locations collapse to file names, zero file:line references remain, and the msgid set is byte-identical to master (locations only, no content change).
  • Simulated the "App catalogs in sync with source" gate with the catalogs reverted: it passes, since the check strips #: lines on both sides before diffing.

Before this merges

Weblate writes .po files back when translators submit, so its component output setting must match (as it already does for --no-wrap) — otherwise it re-adds line numbers and we oscillate. Holding as a draft until that is configured.

got3nks added 2 commits July 28, 2026 21:54
Every catalog entry carried a "#: src/foo.cpp:1234" reference, so any edit
that shifted a line number rewrote the reference block of all 41 catalogs on
the next regen. On a recent GUI PR that came to ~25k changed lines out of a
~27k-line catalog diff -- 93% renumbering, 7 msgids of real content -- and it
made any two PRs in flight conflict in po/ regardless of what they touched.

Pass --add-location=file to xgettext and msgmerge, and the po4a equivalent
--porefs file for the manpage catalogs, so references record the file name
without the line number. Translators keep the "where is this string used"
context Weblate surfaces; the churn disappears.

msgmerge needs the flag as well as xgettext: without it, merging the pot back
into each .po re-expands the references to full file:line.

Scripts only -- the catalogs still hold file:line references and will pick up
the new format the next time they are regenerated. The catalog-sync CI gate
strips "#: " lines before comparing, so it is unaffected either way.
Applies the location format from the previous commit to the committed
catalogs: every '#: src/foo.cpp:1234' collapses to '#: src/foo.cpp', for
both the application catalogs (41 files) and the manpage ones (17).

Content is untouched -- the msgid sets are byte-identical to master (1927
application, 251 manpage entries) and every catalog keeps its existing
translations. Regenerating a second time is a no-op, so the catalogs are
at the fixed point the 'App catalogs in sync with source' and 'Manpage
catalogs in sync with English masters' gates regenerate to.

Rebased onto master first so the extraction sees the strings removed by
the global-connect-button change (amule-project#663).
@got3nks
got3nks force-pushed the chore/po-file-locations branch from c97a9ae to d556f5a Compare July 28, 2026 19:56
@got3nks
got3nks marked this pull request as ready for review July 28, 2026 19:56
@got3nks
got3nks merged commit 31a35f3 into amule-org:master Jul 28, 2026
10 checks passed
@got3nks
got3nks deleted the chore/po-file-locations branch July 28, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant