Frun1na opened a new pull request, #4962:
URL: https://github.com/apache/rocketmq-dashboard/pull/4962
### Which Issue(s) This PR Fixes
<!-- Issue is filed right after this PR; the `Fixes` line is added once it
has a number. -->
### Brief Description
The Audit Log page renders hardcoded Chinese in two places, so an operator
who selected English still sees Chinese:
- the summary cards above the table: the `匹配记录` / `成功率` / `失败 / 部分成功` /
`操作人数` titles, the `高频操作` and `资源类型分布` card titles, the bucket list's `暂无数据`
empty state, and the four `message.error` toasts (record load, summary load,
cleanup, export);
- the cleanup dialog: the day-unit label `天之前的日志` next to the day input.
The cleanup label is the interesting one: the catalog already carries
`audit.cleanupDays` (`清理 {n} 天之前的日志` / `Clean logs older than {n} days`) for
exactly that sentence, but nothing references it, which is why the literal
survived. This PR wires the dialog to a translation key instead of deleting the
unused entry — the sentence is split around the live `InputNumber`, so the unit
gets its own `audit.cleanupDaysUnit` key.
All Chinese values are copied verbatim from the literals they replace, so
the Chinese UI is byte-for-byte unchanged and only the English UI changes. A
test renders the page with the stored language set to `en` and asserts the
summary title and the cleanup unit label are translated; it fails on `main` and
passes with this change.
### How Did You Test This Change?
New test fails before the change and passes after (mutation check, run on
this branch):
```
$ cd web && npx vitest run src/pages/ops/__tests__/AuditPage.test.tsx -t "in
English"
# with the source change stashed, the new test fails:
Test Files 1 failed (1)
Tests 1 failed | 11 skipped (12)
# with the change applied:
✓ src/pages/ops/__tests__/AuditPage.test.tsx (12 tests) 11801ms
✓ renders the summary cards and cleanup dialog in English 644ms
Test Files 1 passed (1)
Tests 12 passed (12)
```
Affected suites plus the language context:
```
$ cd web && npx vitest run src/pages/ops src/i18n
Test Files 11 passed (11)
Tests 99 passed (99)
```
Lint and build of the whole `web` app:
```
$ cd web && npm run lint
✖ 11 problems (0 errors, 11 warnings)
# the 11 warnings are the pre-existing ones in alerts.tsx / systemAlerts.tsx
/ LiteTopic.tsx;
# none of them is in a file this PR touches
$ cd web && npm run build
✓ built in 9.94s
```
No backend code is touched; `server` tests were not run.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks) — no backend files changed
- [x] New source files carry the ASF license header — no new source files
- [x] Documentation touched where behaviour changed (README / `docs/` /
in-app help) — no user-visible contract change beyond the added translations
--
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]