i18n: "% elapsed" in usage timeFormat elapsed/elapsedAndAbsolute is hardcoded English (not translated for zh-Hans/zh-Hant)
Summary
With language: "zh-Hans" (or zh-Hant) and display.timeFormat set to elapsed or elapsedAndAbsolute, the usage line renders the English word "elapsed" while every other word on the line is localized.
The string is built in formatElapsedWindow() in src/render/lines/usage.ts (line 349 on main) as a template literal:
return `${elapsed}% elapsed`;It never goes through t(), and there is no matching key in src/i18n/en.ts, zh-Hans.ts, or zh-Hant.ts.
Steps to Reproduce
~/.claude/plugins/claude-hud/config.json:{ "language": "zh-Hans", "display": { "timeFormat": "elapsedAndAbsolute", "hourCycle": "h23" } }- Pipe any statusline payload that contains
rate_limits.five_hour/seven_dayintobun src/index.ts. - Look at the
用量line.
Expected Behavior
The elapsed wording is localized like the neighbouring format.resetsIn ("重置剩余"), e.g.
用量 ███░░░░░░░ 25% (已过 70%, 09:04:58) | 本周 ████░░░░░░ 40% (已过 57%, Sep 20 07:34:58)Actual Behavior
用量 ███░░░░░░░ 25% (70% elapsed, 09:04:58) | 本周 ████░░░░░░ 40% (57% elapsed, Sep 20 07:34:58)用量, 本周 and (with timeFormat: "both") 重置剩余 are all translated; only elapsed is not. Same result with zh-Hant.
Environment
- OS: macOS 27.0 (arm64)
- Node/Bun version: Bun 1.4.2
- Claude Code version: 2.1.274
- claude-hud: 0.8.0 (the same line is still present on
mainat the time of filing)
Logs or Screenshots
Rendered output above (ANSI stripped). No errors or warnings on stderr with DEBUG=claude-hud.
Suggested fix
The locale files already use {placeholder} patterns plus interpolate() for strings whose layout differs by language (e.g. format.absoluteTime, format.relativeTime), so the same mechanism fits here:
- Add
"format.elapsed"to theMessageKeyunion insrc/i18n/types.ts. - Add the pattern to each locale:
en.ts:"format.elapsed": "{percent}% elapsed"zh-Hans.ts:"format.elapsed": "已过 {percent}%"zh-Hant.ts:"format.elapsed": "已過 {percent}%"
- In
formatElapsedWindow():return interpolate(t("format.elapsed"), { percent: elapsed });
Happy to open a PR if that shape looks right.
Source: jarrodwatts/claude-hud