fix: PromptChoiceScreen subtitle showed target language instead of primary - #41
Merged
Merged
Conversation
…imary The screen rendered the heading and subtitle as identical strings — e.g. both lines read "Comment voulez-vous commencer ?" for any user on the default fr/en pair. Root cause was a mis-keyed Translations object on the subtitle: the fr key held English text and the en key held French text, so .secondary (looking up the primary lang) returned the French value identical to what .primary already showed. Fix: compute the heading once and use both .primary (target) and .secondary (primary) from the same Translations object. Skip the subtitle render when both sides resolve identically (e.g. target falls back to en alongside primary=en). While here, added ja / zh-Hans / zh-Hant keys to all 7 t() calls on this screen — same pattern as the Tier 1 chrome translation sweep in PR #40. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
PromptChoiceScreenrendered the heading and subtitle as identical strings — e.g. both lines read "Comment voulez-vous commencer ?" for any user on the default fr/en pair. The user hit this in screenshot.Root cause
The subtitle used a Translations object with mis-keyed values:
For target=fr primary=en,
.secondarylooks up the en key and got the French value — so the subtitle rendered French again, duplicating the heading visually.Fix
Compute the heading once and use both
.primary(target lang) and.secondary(primary lang) from the same Translations object:The conditional render avoids showing the subtitle when both sides happen to resolve identically (e.g. target=ja primary=en both fall back to the en value if
ja:were missing — same pattern as PR #39'sbilingual()dedupe).While here, added
ja/zh-Hans/zh-Hantkeys to all 7t()calls on this screen — same pattern as PR #40's Tier 1 chrome sweep.Test plan
npx tsc --noEmit— cleannpx vitest run— 188 passed / 189 (only pre-existinguseJournal startFreeWrite)🤖 Generated with Claude Code