tju-yxq opened a new issue, #5578:
URL: https://github.com/apache/rocketmq-dashboard/issues/5578
## Problem
Two leftover i18n gaps in the shared utils layer:
1. **`utils/timeZone.ts` throws English-only errors** — `Invalid local date
time: {value}` (two sites) and `Local date time does not exist in {timeZone}:
{value}`. The only consumer, the system alerts page's silence form, surfaces
`error.message` verbatim in its toast (`message.error(error.message)` in the
catch around `zonedLocalDateTimeToUtc`), so a Chinese-locale operator who picks
a wall-clock time skipped by DST gets an English error while the rest of the
form is Chinese.
2. **`UserManagement.tsx`'s `durationText` calls `formatDelay(value)`
without the `lang` argument** — `formatDelay` defaults to zh, so the session
table's "Idle For" and "Remaining Validity" columns always render Chinese
durations (`22小时55分钟`) even when the console language is English. The consumer
page passes `lang` correctly; the user management page never did.
## Expected Behavior
- `zonedLocalDateTimeToUtc` throws a dedicated `TimeFormatError` carrying a
translation key plus params (`timeZone.invalidLocalDateTime` /
`timeZone.nonexistentLocalDateTime` with `{value}` / `{timeZone}`); the silence
form's catch resolves it through `t(key, params)` and falls back to the raw
message for any other error — the same key-returning contract as the other
analysis utils.
- The user management duration columns pass the console `lang` to
`formatDelay`, so the durations follow the display language.
- The zh silence-form error text changes from English to Chinese (`本地时间
{value} 在时区 {timeZone} 不存在`), which matches the rest of the form's language.
## Notes
- Two new `timeZone.*` keys; `TimeFormatError` is exported for the catching
page's `instanceof` check.
- `formatDelay` itself is untouched — it is already bilingual; only the
missing argument at the one call site is fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]