Skip to content

feat: localize menu chrome, results, baseline prompt, and command palette#13

Merged
agolosnichenko merged 5 commits into
mainfrom
feat/localize-tui-chrome
Jun 7, 2026
Merged

feat: localize menu chrome, results, baseline prompt, and command palette#13
agolosnichenko merged 5 commits into
mainfrom
feat/localize-tui-chrome

Conversation

@agolosnichenko

Copy link
Copy Markdown
Owner

What

With a Russian UI locale, parts of the interface still rendered in English. This translates the remaining chrome so the whole visible UI follows the selected UI language.

  • Footer labels (Benchmark/Progress/Achievements/Settings/Quit on the menu, plus Back/Continue/Abandon/Yes/Skip on other screens) and the system palette label.
  • Dashboard tagline under the banner (version + lessons-cleared count).
  • Results screen body — headline, WPM/Accuracy/Errors/XP/Level/Streak/Unlocked labels.
  • Baseline prompt buttons (Yes/Skip).
  • Command palette — built-in system command titles and help, and the search placeholder.

How

  • AppScreen.active_bindings is overridden to translate each binding's description to the current UI locale. The Footer reads this property on every recompose, so labels stay in sync without mutating the static BINDINGS. MenuScreen.on_screen_resume calls refresh_bindings() so the menu footer updates after a language switch in settings.
  • ResultsScreen.summary_lines takes an injected translator + locale, keeping it unit-testable without a running TUI.
  • BaselinePrompt accepts yes_label/skip_label, passed translated from the menu.
  • TypeHeroApp.get_system_commands rewrites built-in command title/help via a map keyed on the unique English help string, preserving Textual's stateful callbacks; action_command_palette passes a translated placeholder.
  • New footer.*, results.*, baseline.*, and palette.* keys in en.yaml/ru.yaml.

Tests

Added regression tests for footer/tagline localization, live language-switch refresh, results-body localization, baseline button labels, and palette command/placeholder localization. Full suite: 269 passed; ruff and ty clean.

🤖 Generated with Claude Code

agolosnichenko and others added 5 commits June 7, 2026 17:16
…ette

Footer binding labels and the dashboard tagline rendered in English even
with a Russian UI locale, because BINDINGS descriptions and the tagline
were static literals fixed at import time. Translate footer labels via an
active_bindings override on AppScreen (read by the Footer on every
recompose), and drive the tagline from the translator.

Also localize the results-screen body (summary_lines now takes an injected
translator + locale), the baseline prompt buttons, and the command palette
(system command titles/help and the search placeholder).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
on_screen_resume re-assigned the same ListView index after clearing and
re-extending the list. Re-assigning an unchanged reactive is a no-op, so
watch_index never re-applied the -highlight class to the rebuilt rows and
the selected lesson became invisible at startup and after a lesson.

Await clear/extend so the index is restored against the rebuilt rows, and
clear the index first to force the watcher to run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add drift-guard tests asserting every footer binding and Textual system
command has an i18n key, and that the map keys still match Textual's
English strings. Drop the unused footer.yes/footer.skip keys, default a
menu rebuild with no selection to the first row, and expand the docs on
the i18n maps and command-palette override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collapse the repeated translator/ui_locale lookup into a single
AppScreen.t(key) method and route footer, menu, settings, and baseline
prompt strings through it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agolosnichenko agolosnichenko merged commit 941f445 into main Jun 7, 2026
1 check passed
@agolosnichenko agolosnichenko deleted the feat/localize-tui-chrome branch June 7, 2026 10:10
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