feat(i18n): localize context-inspector surface across 7 locales#2572
feat(i18n): localize context-inspector surface across 7 locales#2572gordonlu wants to merge 1 commit 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. This is a useful i18n direction, but I’m not harvesting it into the v0.8.50 release branch yet because the current patch still leaves part of the context-inspector surface in English and the status handling is a little too stringly for a release cut. Concrete next steps that would make this much easier to land:
The idea has value; it just needs that last precision pass before it belongs in this release lane. |
|
Hey @gordonlu — really excited to see the i18n coverage expanding to the context inspector! The queue and fanout PRs (#2568, #2566) landed beautifully in v0.8.50. For this one, a couple of things before it's harvest-ready:
The structure is solid — it's mostly filling in the remaining spots. Happy to review when you've got those addressed. No rush — i18n is a marathon, not a sprint! 🌐🐋 |
0def0a8 to
2ad73c4
Compare
8a14157 to
601f83a
Compare
601f83a to
3d04816
Compare
Localize all user-facing strings in the compact session context inspector (
Alt+C//context).Changes
CtxInsp*MessageIds for the context-inspector surfacelocalethroughbuild_context_inspector_text()→ helper functionstr()for section headers, labels (Model / Workspace / Session / Context / Transcript / Workspace status), status words (ok / high / critical / included / attached / not included / output captured / no output yet), empty-state messages, and the pager titleinspector_localizes_to_zh_hanssmoke testFiles
crates/tui/src/localization.rscrates/tui/src/tui/context_inspector.rscrates/tui/src/tui/ui.rsGreptile Summary
This PR localizes the compact session context inspector (
Alt+C//context) across 7 locales by adding 45CtxInsp*MessageIdvariants and wiringtr()calls throughout thebuild_context_inspector_textcall tree. It also refactorscontext_statusfrom returning raw&'static strliterals to returning a typedContextPressureenum, eliminating the silent fallback that was flagged in a previous review.tr()in bothcontext_inspector.rsandui.rs.ContextPressureenum: replaces the raw\"critical\"/\"high\"/\"ok\"string dispatch; the exhaustive match now guarantees new pressure tiers are handled explicitly.inspector_localizes_to_zh_hansvalidates that key Simplified-Chinese labels appear and no English labels leak, complementing the existing English-locale tests updated to passLocale::En.Confidence Score: 5/5
Safe to merge — the change is additive (new MessageIds, tr() wiring) and the refactor to ContextPressure enum removes a previously fragile raw-string dispatch.
All strings that were previously hardcoded English are now routed through tr(). The context_status refactor to ContextPressure makes the match exhaustive so future tiers cannot silently fall through to ok. Every existing test was updated to pass Locale::En and a new zh-hans smoke test covers both positive presence and negative leak checks. Translations are provided for all 7 declared locales; Traditional Chinese correctly delegates unhandled ids to Simplified Chinese. No logic regressions are introduced.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["open_context_inspector(app)"] --> B["build_context_inspector_text(app, app.ui_locale)"] B --> C["tr(locale, CtxInspSessionContext)\nModel / Workspace / Session labels"] B --> D["context_status(percent)\n→ ContextPressure enum"] D -->|Critical| E["tr(locale, CtxInspCritical)"] D -->|High| F["tr(locale, CtxInspHigh)"] D -->|Ok| G["tr(locale, CtxInspOk)"] B --> H["push_system_prompt_structure(out, app, locale)"] H --> H1["Blocks arm\ntr(CtxInspStablePrefix / CtxInspVolatileWorkingSet\n/ CtxInspBlocks / CtxInspBlock / CtxInspTokens)"] H --> H2["Text arm\nlayer.kind.label(locale)\n→ tr(CtxInspCacheFriendly | CtxInspChangesByTurn)"] H --> H3["None arm\ntr(CtxInspNoSystemPrompt)"] H --> H4["tr(CtxInspCacheTip)"] B --> I["push_references(out, refs, locale)"] I --> I1["tr(CtxInspIncluded / CtxInspAttached / CtxInspNotIncluded)\ntr(CtxInspMoreReferences)\ntr(CtxInspNoReferences)"] B --> J["push_tools(out, app, locale)"] J --> J1["push_tool_row(out, locale, location, detail)\ntr(CtxInspActive | CtxInspCell)\ntr(CtxInspOutputCaptured | CtxInspNoOutputYet)"] J --> J2["tr(CtxInspNoToolActivity | CtxInspAltVHint)"] A --> K["tr(app.ui_locale, CtxInspTitle)\n→ PagerView title"]Comments Outside Diff (1)
crates/tui/src/tui/context_inspector.rs, line 326-328 (link)"- ... {remaining} more reference(s)"is user-facing but has no translation. When references exceedMAX_REFERENCE_ROWS, non-English users receive a raw English notice while every other string on that screen is localized.Reviews (7): Last reviewed commit: "feat(i18n): localize context-inspector s..." | Re-trigger Greptile