Frun1na opened a new pull request, #4641:
URL: https://github.com/apache/rocketmq-dashboard/pull/4641
## Which Issue(s) This PR Fixes
Fixes #<to-be-filled>
## Brief Description
On the alert rules page (`web/src/pages/ops/alerts.tsx`), the table's
`showTotal` callback calls `t('alerts.totalRules', { count: total })`, but the
`alerts.totalRules` translation has no `{count}` placeholder — it is just
"规则总数" / "Total Rules". `LangContext.t` only substitutes placeholders that
exist in the string, so the pagination total renders the bare label with no
number.
This PR adds a placeholder-bearing key `alerts.totalRulesWithCount` ("共
{count} 条规则" / "{count} rules total", mirroring the existing `acl.totalRules`)
and uses it for the pagination total. The bare `t('alerts.totalRules')` heading
on the page keeps the existing key and its value is unchanged.
## How Did You Test This Change?
```
$ cd web && npx vitest run src/pages/ops/__tests__/AlertsPage.test.tsx
Tests 27 passed (27)
```
The new test mocks a page with total 21 and asserts `共 21 条规则` is rendered;
before the fix it fails because the pagination total shows only 规则总数. `tsc
--noEmit` and `eslint` report no errors.
## Checklist
- [x] I have performed a self-review of the code
- [x] New tests cover the change
- [x] The change follows the existing code style
--
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]