Skip to content

fix(i18n): localize quota reset countdown time units#4104

Merged
chrox merged 1 commit into
mainfrom
fix/i18n-quota-reset-countdown
May 9, 2026
Merged

fix(i18n): localize quota reset countdown time units#4104
chrox merged 1 commit into
mainfrom
fix/i18n-quota-reset-countdown

Conversation

@chrox
Copy link
Copy Markdown
Collaborator

@chrox chrox commented May 9, 2026

Summary

  • The quota "Resets in" countdown on the user page formatted its duration via dayjs.duration().format('H [hr] m [min]'), baking English hr / min literals into the rendered string. Non-English locales got mixed output like 18 hr 6 min后重置.
  • Move the unit literals into the translation key itself — Resets in {{hours}} hr {{minutes}} min — so each locale controls word order and abbreviation. Compute hours/minutes inline; drop the unused dayjs / @/utils/time imports in Quota.tsx.
  • Translated the new key for all 33 shipped locales (zh-CN: {{hours}} 小时 {{minutes}} 分钟后重置, etc.); pnpm i18n:extract removed the now-unused Resets in {{duration}} key.

Test plan

  • pnpm test (4096 passed)
  • pnpm lint
  • Verified zh-CN renders e.g. 18 小时 6 分钟后重置

🤖 Generated with Claude Code

The "Resets in {{duration}}" indicator on the user page formatted its
duration via dayjs with literal "[hr]" / "[min]" tokens, which bypassed
i18n entirely. Non-English locales rendered mixed strings like
"18 hr 6 min后重置".

Move the unit literals into the translation key itself
("Resets in {{hours}} hr {{minutes}} min") so each locale controls word
order and unit abbreviations, and translate the new key for all 33
shipped locales.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chrox chrox merged commit e0b3a6f into main May 9, 2026
8 checks passed
@chrox chrox deleted the fix/i18n-quota-reset-countdown branch May 9, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant