Skip to content

feat(cli): localize TUI main interface, welcome, sessions, and peers screens#6241

Merged
houko merged 77 commits into
librefang:mainfrom
pavver:feat/ukrainian-cli-i18n-new
Jun 20, 2026
Merged

feat(cli): localize TUI main interface, welcome, sessions, and peers screens#6241
houko merged 77 commits into
librefang:mainfrom
pavver:feat/ukrainian-cli-i18n-new

Conversation

@pavver

@pavver pavver commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Type

  • Agent template (TOML)
  • Skill (Python/JS/Prompt)
  • Channel adapter
  • LLM provider
  • Built-in tool
  • Bug fix
  • Feature (Rust)
  • Documentation / Translation
  • Refactor / Performance
  • CI / Tooling
  • Other

Summary

This PR localizes the core CLI TUI main interface (tui/mod.rs), the TUI Welcome screen (tui/screens/welcome.rs), the Sessions screen (tui/screens/sessions.rs), and the Peers screen (tui/screens/peers.rs) to support English, Ukrainian, and Simplified Chinese.

All user-facing strings are refactored to use Fluent localization keys. Pluralization logic is implemented cleanly via Fluent templates.

Changes

Source Code Refactoring (crates/librefang-cli/src/)

[MODIFY] mod.rs

  • Replaced all hardcoded system messages, slash commands help descriptions, status lines, and hands info displays with crate::i18n::t and crate::i18n::t_args.
  • Reused existing chat-runner- keys for general messages (e.g. model switching, connection errors) to maintain consistency.
  • Refactored Tab::label(self) to load localized tab names dynamically from Fluent.
  • Refactored Ctrl+C double-press quit hint to support dynamic localization.

[MODIFY] welcome.rs

  • Refactored menu items state (MenuItem struct) to hold owned String labels and hints instead of static &'static str lifetimes to support dynamic localization.
  • Localized all menu labels, hints, and command status messages.
  • Implemented Fluent-native plurals (tui-welcome-agent-count) for active daemon agent display.

[MODIFY] sessions.rs

  • Localized screen title, table headers, loading spinner, search query filter hint, empty state message, delete confirmation, and navigation hint footer.
  • Handled pluralization for the active session count cleanly via Fluent.

[MODIFY] peers.rs

  • Localized screen title, network section headers, active peer counts, table headers, loading spinner, connection statuses (Active, Offline, Pending), empty state, and auto-refresh footer hint.

Localization Files (crates/librefang-cli/locales/)

[MODIFY] en/main.ftl

  • Added new Fluent localization keys for TUI tab headers (tui-tab-*), welcome screen items (tui-welcome-*), sessions screen (tui-sessions-*), and peers screen (tui-peers-*).

[MODIFY] uk/main.ftl

  • Added full Ukrainian translations for the new TUI, Welcome, Sessions, and Peers localization keys.

[MODIFY] zh-CN/main.ftl

  • Added full Simplified Chinese translations for the new TUI, Welcome, Sessions, and Peers localization keys.

Testing

  1. Clippy Validation:
    Clean build with no warnings:
    cargo clippy -p librefang-cli --all-targets -- -D warnings
  2. Cargo Test:
    All 240+ unit/integration tests in the workspace pass successfully.
  3. Build and Run:
    Verified that the interactive TUI boots up correctly, displays localized tab names and welcoming options, and handles sessions/peers layout and actions flawlessly under different locales.

pavver added 30 commits June 19, 2026 23:33

@houko houko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean, mechanical localization with no behavior changes.

Verified:

  • The Rust changes across the 38 CLI/TUI files are pure string → i18n::t/t_args replacements. Spot-checked the largest (commands/skill.rs, +493/-133) — all of it is i18n::t_args(...) call conversions, no logic changes.
  • i18n::t/t_args fall back to the default en language when a key is missing (i18n.rs), so partial locales degrade to English rather than showing raw keys.
  • CI is green.

One non-blocking note: the zh-CN locale is ~55% complete — 870 keys vs en 1590 / uk 1589. Chinese-locale users will see English for the ~720 untranslated keys. Acceptable given the graceful en fallback, but worth tracking completion of zh-CN in a follow-up so the experience isn't half-English. uk is essentially complete.

Approving.

@github-actions github-actions Bot added the ready-for-review PR is ready for maintainer review label Jun 19, 2026
@houko
houko merged commit 9da53e0 into librefang:main Jun 20, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review PR is ready for maintainer review size/XL 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants