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

   ### Which Issue(s) This PR Fixes
   
   No issue - follows the same localization pass as #4621, #4629 and #4633.
   
   ### Brief Description
   
   `web/src/pages/ops/audit.tsx` reads every other label through `useLang()`, 
but five strings were still literals, so an English console showed Chinese text:
   
   | line | literal | now |
   | --- | --- | --- |
   | 166 | record-list load failure toast | `audit.loadFailed` |
   | 225 | summary load failure toast | `audit.summaryLoadFailed` |
   | 299 | cleanup failure toast | `audit.cleanupFailed` |
   | 310 | export failure toast | `audit.exportFailed` |
   | 580 | trailing half of the cleanup-days sentence | 
`audit.cleanupDaysSuffix` |
   
   The four toasts are worded after `audit.timelineLoadFailed` / 
`audit.timelineExportFailed`, which already cover the resource-operation drawer 
that shares this page's export path. Two of them are used inside `useEffect`, 
so they are hoisted to stable strings and added to the dependency arrays - 
depending on `t` directly would refetch on every language-context render, which 
is what `Ops.tsx:46` already avoids the same way.
   
   The cleanup modal built its sentence out of `t('audit.cleanup')` + 
`<InputNumber>` + a hardcoded tail. That rendered as an ungrammatical English 
fragment and repeated the word for "logs" twice in Chinese. It is now 
`audit.cleanupDaysPrefix` + `<InputNumber>` + `audit.cleanupDaysSuffix`, so 
each language puts the number where its grammar wants it, and the pair was 
split out of the existing `audit.cleanupDays` entry so the modal and the 
success toast describe the same action in the same words. `t('audit.cleanup')` 
keeps its other use as the toolbar button label.
   
   The Chinese values are moved verbatim, not rewritten; only English text is 
new.
   
   ### How Did You Test This Change?
   
   ```
   cd web
   npx vitest run src/pages/ops/__tests__/AuditPage.test.tsx 
src/utils/download.test.ts
    Test Files  2 passed (2)
         Tests  15 passed (15)
   
   npx tsc -b            # exit 0
   npx eslint src/pages/ops/audit.tsx src/i18n/translations.ts   # exit 0
   ```
   
   Baseline for reference, unchanged by this diff: `npm test` on the trunk 
gives 139 files / 1280 tests passing.
   
   Also re-ran the dictionary reconciliation over every literal `t('...')` key 
in `web/src` against `translations.ts`: 1318 used keys, 0 missing, so the six 
new entries resolve and nothing else regressed.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / 
`refactor:` / `chore:` / `docs:` / `perf:`)
   - [ ] Tests added or updated for non-trivial changes, test methods named 
`...Test` - the existing `AuditPage.test.tsx` covers the page; no assertion 
depended on the literals
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks) - N/A, frontend only
   - [ ] New source files carry the ASF license header - N/A, no new files
   - [ ] Documentation touched where behaviour changed - N/A, no documented 
contract changed
   


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