Support parsing and compiling previous translations in obsolete entries#112
Closed
kisaragi-hiu wants to merge 3 commits into
Closed
Support parsing and compiling previous translations in obsolete entries#112kisaragi-hiu wants to merge 3 commits into
kisaragi-hiu wants to merge 3 commits into
Conversation
\#~| is common and often generated by msgmerge.
kisaragi-hiu
force-pushed
the
fix-obsolete-previous
branch
from
June 30, 2026 21:29
0aae23d to
14256c4
Compare
smhg
added a commit
that referenced
this pull request
Jul 6, 2026
Recognize `#~|` comments, which msgmerge emits when an entry carrying a `--previous` msgid is later marked obsolete. Previously these threw "Invalid key name". The previous string round-trips as an opaque comment, consistent with existing non-obsolete `#|` handling. Fixes #111. Co-authored-by: Kisaragi Hiu <mail@kisaragi-hiu.com>
Owner
|
Squash-merged as 8ebe726, released in v9.1.0. Thanks @kisaragi-hiu! |
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.
Fixes #111. After investigating that I thought I might try my hand at fixing it.
A
#~|is a previous (un)translated string (like#|) in an obsolete entry, and is emitted when a string is translated, updated withmsgmerge --previous(thus creating a#|previous translation), then made obsolete (removed) before a translator could act on it.msgmergegenerates it as seen in this msgmerge test case.The approach I've taken here for lexing seems to be what GNU Gettext does as well. (While the GNU Gettext comment says it "does not make sense semantically, and is implemented here for completeness only", it does actually make sense to exist as explained above, and does actually exist in the wild in at least 200k files.)