chore(i18n): record catalog locations by file, not file:line - #673
Merged
Conversation
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
force-pushed
the
chore/po-file-locations
branch
from
July 28, 2026 19:56
c97a9ae to
d556f5a
Compare
got3nks
marked this pull request as ready for review
July 28, 2026 19:56
This was referenced Jul 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every catalog entry carries a
#: src/foo.cpp:1234reference. 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 inpo/regardless of what they actually touch — #642, #643, #662, #663 and #664 all hit it.What
scripts/update-po.sh:--add-location=fileon bothxgettextandmsgmerge. The flag is needed onmsgmergetoo — without it, merging the pot back into each.pore-expands references to fullfile: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:linereferences and will pick up the new format the next time they are regenerated, so this does not collide with anything in flight.Verification
file:linereferences remain, and the msgid set is byte-identical to master (locations only, no content change).#:lines on both sides before diffing.Before this merges
Weblate writes
.pofiles 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.