i18n: "% elapsed" in usage timeFormat elapsed/elapsedAndAbsolute is hardcoded English (not translated for zh-Hans/zh-Hant)

Author: ShengjiaCuiCreated Sep 17, 2026Updated Sep 17, 2026

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:

typescript
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

  1. ~/.claude/plugins/claude-hud/config.json:
    json
    { "language": "zh-Hans", "display": { "timeFormat": "elapsedAndAbsolute", "hourCycle": "h23" } }
  2. Pipe any statusline payload that contains rate_limits.five_hour / seven_day into bun src/index.ts.
  3. 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 main at 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:

  1. Add "format.elapsed" to the MessageKey union in src/i18n/types.ts.
  2. Add the pattern to each locale:
    • en.ts: "format.elapsed": "{percent}% elapsed"
    • zh-Hans.ts: "format.elapsed": "已过 {percent}%"
    • zh-Hant.ts: "format.elapsed": "已過 {percent}%"
  3. In formatElapsedWindow():
    typescript
    return interpolate(t("format.elapsed"), { percent: elapsed });

Happy to open a PR if that shape looks right.