Wang1rrr opened a new pull request, #4825:
URL: https://github.com/apache/rocketmq-dashboard/pull/4825

   <!-- Make sure the base branch is `master`: that is the RocketMQ Studio 
trunk. -->
   
   ### Which Issue(s) This PR Fixes
   
   Trivial fix, no issue.
   
   ### Brief Description
   
   `web/src/pages/ops/AuditSummaryCards.tsx` was the last component on the 
audit page that never touched the language layer: it rendered seven hardcoded 
Chinese strings, so switching the console to English left the whole summary row 
(匹配记录 / 成功率 / 失败 · 部分成功 / 操作人数 / 高频操作 / 资源类型分布 / 暂无数据) in Chinese while 
`ops/audit.tsx` and `AuditRiskInsights.tsx` around it translated correctly.
   
   The labels now go through `useLang()`. Two of them reuse dictionary entries 
that already carry the identical Chinese text rather than adding duplicates:
   
   - `common.noData` for the empty-bucket placeholder
   - `auditInsights.failPartial` (`失败 / 部分成功` → `Failed / Partial`) for the 
failed/partial card
   
   Five new keys are added next to the existing `audit.*` block in 
`web/src/i18n/translations.ts`, each with a Chinese and an English value:
   
   | key | zh | en |
   | --- | -- | -- |
   | `audit.summaryMatched` | 匹配记录 | Matched Records |
   | `audit.summarySuccessRate` | 成功率 | Success Rate |
   | `audit.summaryOperators` | 操作人数 | Operators |
   | `audit.summaryTopOperations` | 高频操作 | Top Operations |
   | `audit.summaryResourceTypes` | 资源类型分布 | Resource Type Distribution |
   
   No behaviour changes: the numbers, the progress bars and the top-5 bucket 
slice are untouched.
   
   ### How Did You Test This Change?
   
   ```
   cd web
   npx vitest run src/pages/ops/__tests__/AuditSummaryCards.test.tsx 
src/pages/ops/__tests__/AuditPage.test.tsx 
src/pages/ops/__tests__/AuditRiskInsights.test.tsx src/i18n
    Test Files  5 passed (5)
         Tests  27 passed (27)
   
   npx tsc -b                                    (exit 0)
   npx eslint src/pages/ops/AuditSummaryCards.tsx 
src/pages/ops/__tests__/AuditSummaryCards.test.tsx src/i18n/translations.ts   
(exit 0)
   npx prettier --check --end-of-line auto src/pages/ops/AuditSummaryCards.tsx 
src/pages/ops/__tests__/AuditSummaryCards.test.tsx src/i18n/translations.ts
   All matched files use Prettier code style!
   ```
   
   (`--end-of-line auto` because this checkout is CRLF while `.prettierrc` pins 
`endOfLine: lf`; untouched trunk files fail a plain `--check` here for the same 
reason.)
   
   New `web/src/pages/ops/__tests__/AuditSummaryCards.test.tsx` covers all 
three cases: every label in Chinese under the default language, every label in 
English with `LANGUAGE_STORAGE_KEY = 'en'` (plus an assertion that the Chinese 
label is gone), and the empty-bucket placeholder appearing in both buckets.
   
   Mutation-checked: reverting one label to its hardcoded literal 
(`title={t('audit.summaryMatched')}` back to the Chinese string) fails exactly 
`renders every card label in English when the console language is English` 
while the other two stay green.
   
   ### 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 change
   - [x] New source files carry the ASF license header
   - [x] Documentation touched where behaviour changed (README / `docs/` / 
in-app help) - none needed
   


-- 
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]

Reply via email to