tju-yxq opened a new issue, #5576:
URL: https://github.com/apache/rocketmq-dashboard/issues/5576
## Problem
The metrics explorer (`components/MetricsExplorer.tsx`) carries its own
**parallel i18n system**: a ~110-line inline `copy` object that branches on
`lang === 'zh' ? { ...50 Chinese entries... } : { ...50 English entries... }`,
plus a `queryErrorFallback` ternary. While the strings are technically
bilingual, the table bypasses `translations.ts` entirely:
- New entries must be added twice in a component file instead of once in the
translation table every other surface uses.
- The convention for interpolation differs: `hiddenSeries` is a function
closure instead of the `{param}` placeholder style.
- The zh and en tables can drift (a key added to one branch and forgotten in
the other compiles fine and shows `undefined` at runtime).
Every other shared component resolves its strings through `useLang()`'s
`t()` + `translations.ts`; the metrics explorer is the only one with an
embedded copy table.
## Expected Behavior
The 50-entry copy table and the query-error fallback migrate to `metrics.*`
keys in `translations.ts`; the component keeps its local `copy` object shape
(so its 88 usage sites are untouched) but each entry becomes a `t('metrics.…')`
call — `hiddenSeries` uses the standard `{count}` / `{kept}` placeholders. The
rendered text is byte-identical in both languages.
## Notes
- 52 new `metrics.*` entries (50 copy entries + `hiddenSeries` +
`queryErrorFallback`).
- The component's language-change discipline (labels read through a ref in
query callbacks) is unchanged — the `copy` object is still rebuilt per render
from `t()`, and the existing `queryLabelsRef` effect keeps its behavior.
--
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]