Repository navigation
fix: tools: i18n-extract finds tr calls made through local helpers - #2755
Merged
Merged
Conversation
Since the CLI renderers bind `tr = I18n.tr translations_` locally, their calls read `tr "text"`, without the Translations argument the extractor required; it stopped seeing 29 strings and `just i18n-check` reported them stale. The argument is now optional, and the template is regenerated. AI usage: Claude Fable 5.1, ~1k output tokens.
The template's #: lines now name only the source files a text appears in. With line numbers, any change that shifted code rewrote hundreds of references on the next regeneration, so every branch that regenerated the template conflicted with every other (hledgerorg#2736 review). Now the template changes only when strings are added, removed, or move to another file. AI usage: Claude Opus 5.5, ~1k output tokens.
acinader
force-pushed
the
i18n-extract-fix
branch
from
September 30, 2026 04:50
9c7bf0b to
8e39e78
Compare
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.
Two fixes to the catalog extractor, both from the #2736 follow-up:
trcalls made through local helpers. Since the CLI renderers bindtr = I18n.tr translations_locally, their calls readtr "text", without the Translations argument the extractor required; it stopped seeing 28 strings, andjust i18n-checkreported them stale.just i18n-potwould have dropped them from the template. The argument is now optional.#:lines now name only the source files a text appears in, like xgettext's--add-location=file, so the template changes only when strings are added, removed, or move to another file, and branches that regenerate it stop conflicting.If this goes in first, the open web PRs (#2749, #2753, #2754) no longer need to touch the template at all; I've rebased them that way.
Test plan
On main,
just i18n-checkreports 28 stale entries:On this branch it reports none:
just i18n-potleaveshledger-lib/locale/hledger.potunchanged, and its#:lines carry file names only, eg#: hledger/Hledger/Cli/CompoundBalanceCommand.hs.Add a blank line near the top of any source file with translatable strings, eg
hledger/Hledger/Cli/CompoundBalanceCommand.hs, and runjust i18n-potagain: the template is still unchanged.