Skip to content

[Bug]: FloatBar inline reset is not compacted for non-English locales (English-only "Resets in " stripping) #497

Closed

Description

@xiedidan

What happened?

In the floating capacity bar (taskbar widget), the optional inline reset text is only shortened for English. With a non-English UI language (e.g. Simplified Chinese) the pill shows the full localized relative string, which is long and makes the pill unnecessarily wide.

Examples for a 5-hour window:

  • English UI: Resets in 4h 59m -> inline shows 4h 59m
  • Chinese UI: 4 小时 59 分钟后重置 -> inline shows the whole phrase 4 小时 59 分钟后重置

Expected: the inline reset should be compact in every locale (e.g. 4h59m / 4小时59分), while the full text stays in the tooltip.

Affected area

  • Tray panel

Steps to reproduce

  1. Set ui_language to chinese (Settings -> General -> Language -> 中文).
  2. Enable the floating bar: float_bar_enabled = true, float_bar_style = "taskbar", float_bar_show_reset_inline = true.
  3. Select a provider that has a short session window, e.g. Codex with provider_metrics: { "codex": "session" }.
  4. Look at the pill: it renders the full localized string X 小时 Y 分钟后重置 instead of a compact Xh Ym.

Root cause

inlineResetTime() in apps/desktop-tauri/src/floatbar/FloatBar.tsx compacts only English strings:

function inlineResetTime(resetText: string): string {
  const normalized = resetText.trim();
  if (/^reset(?:s|ting)?(?:\s+due)?\s*(?:now)?$/i.test(normalized)) {
    return "now";
  }
  return normalized
    .replace(/^resets?\s+in\s+/i, "")
    .replace(/^resets?\s+/i, "")
    .trim();
}

useFormattedResetTime() returns a fully localized string from the Fluent keys ResetsInHoursMinutes / ResetsInDaysHours / ResetsInMinutes / TrayResetsDueNow (see rust/src/locale/*.ftl). Only the English variant starts with Resets in , so the replace() calls strip nothing for other locales.

Verified zh-CN (rust/src/locale/zh-CN.ftl):

ResetsInDaysHours = {} 天 {} 小时后重置
ResetsInHoursMinutes = {} 小时 {} 分钟后重置
ResetsInMinutes = {} 分钟后重置

The resets now branch is also English-only, so TrayResetsDueNow (e.g. "现在重置") is not compacted to now either.

Suggested fix (any one)

  1. Compose the inline reset from structured parts (days/hours/minutes) with a locale-aware short unit, e.g. Intl.RelativeTimeFormat(locale, { numeric: "auto", style: "narrow" }), instead of stripping a localized prefix.
  2. Add a dedicated compact Fluent key per locale (e.g. ResetsInlineHoursMinutes = {}h {}m / {}时{}分) for the inline reset, keeping the full string for the tooltip.
  3. Add locale-aware suffix stripping for the known forms (后重置, 後重置, 後にリセット, ...).

Note: reusing ResetsInShort is not sufficient by itself, since it only contains the "resets" label without the duration.

App version

0.56.8

Windows version

Windows 11 Pro build 26200 (25H2)

Additional context

The compact form is only cosmetic; the underlying reset data is correct. On this machine switching ui_language to english is the current workaround to get the short 4h 59m pill.

Activity

  1. Finesssee commented on Sep 14, 2026

    @Finesssee
    Collaborator

    Hey, thanks for the report. I will fix this ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions