feat(i18n): add FanoutCounts MessageId, wire into FanoutCard#2566
feat(i18n): add FanoutCounts MessageId, wire into FanoutCard#2566gordonlu wants to merge 5 commits into
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Thanks @gordonlu. Localizing the fanout counts line is a good, contained idea, and the production call site is small. The blocker I see from CI is Windows, not the fanout localization itself: After that Windows test fix and a green CI rerun, this should be much easier to review/harvest as an i18n-only change. |
|
Hey @gordonlu — the FanoutCounts i18n has been harvested into v0.8.50 (#2504)! Clean work with the named placeholders ({done}, {running}, etc.) and the ZhHans smoke test. One small note: there was a duplicate fix commit shared with #2568 (the Instant overflow and fmt commits), which I skipped during cherry-pick — no issue, just FYI for future stacked PRs. Thank you! 🌐🐋 |
Summary
Add
FanoutCountsMessageId and wire it intoFanoutCard::render_lines()for i18n of the aggregate worker stats line.Changes
localization.rs— newFanoutCountsvariant with named placeholders ({done},{running},{failed},{pending}) in all 7 shipped localesagent_card.rs— addlocale: Localefield toFanoutCard,new(kind, locale), render stats viatr(locale, FanoutCounts).replace(...)subagent_routing.rs— passapp.ui_localeat the one production call siteviews/mod.rs— test caller passesapp.ui_localeTesting
fanout_card_aggregate_counts_match_dot_gridensures English still renders correctlyfanout_counts_are_localizedsmokes ZhHans output for已完成/运行中/失败/等待中Greptile Summary
This PR adds i18n support for the fanout card's aggregate worker stats line, replacing a hardcoded English format string with a localized template resolved through the existing
tr()/MessageIdsystem. The locale is captured once atFanoutCardcreation and stored as a struct field.FanoutCountsis added toMessageIdwith translations in all 7 shipped locales (En, Vi, ZhHant, Ja, ZhHans, PtBr, Es419); the existing English fallback path infallback_translationcovers any future locale additions automatically.FanoutCard::newgains alocaleparameter; every call site (one production, one view test) is updated to passapp.ui_locale.ui/tests.rsare refactored to build their time values by addition rather than subtraction fromInstant::now(), avoiding potential subtraction-before-boot panics on very short-running test environments.Confidence Score: 5/5
Safe to merge — the change is well-scoped, all call sites are updated, and the fallback to English ensures no blank output even for future locale additions.
All seven shipped locales include the new FanoutCounts translation, the existing English fallback covers any gaps, every FanoutCard::new call site has been updated, and the new localization test verifies Chinese Simplified output end-to-end. The timer-test refactor in ui/tests.rs is a correctness improvement with no behavioral regression risk.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant SR as subagent_routing participant FC as FanoutCard participant L as localization::tr() participant UI as render_lines() SR->>FC: new(kind, app.ui_locale) Note over FC: stores locale as field FC->>FC: upsert_worker(id, lifecycle) UI->>FC: render_lines(width) FC->>FC: counts() → (done, running, failed, pending) FC->>L: tr(self.locale, FanoutCounts) L-->>FC: "&'static str template" FC->>FC: ".replace("{done}", ...).replace("{running}", ...)..." FC-->>UI: "Vec<Line<'static>> with localized stats line"Reviews (3): Last reviewed commit: "Revert "fix: restore two-line draft head..." | Re-trigger Greptile