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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5224
   
   ### Brief Description
   
   Two home surfaces sit next to properly localized text but bypass the 
translation table:
   
   - `web/src/pages/home/dashboard.tsx:168-172` — the load-failure `Alert` 
hardcodes `message="仪表盘加载失败"`, `description="无法获取集群概览,请检查网络连接后重试。"` and a 
literal `重试` button, even though the component already holds `t` from 
`useLang()` and the repo already has a `common.retry` key.
   - `web/src/pages/home/index.tsx:505` — the footer localizes its neighbours 
(`t('home.community')`, `t('home.brand')`) and then renders `当前版本 
{__BUILD_TIME__} build({__BUILD_COMMIT__})` as raw Chinese for every viewer.
   
   The alert now resolves `homeDashboard.loadFailed`, 
`homeDashboard.loadFailedDescription` and `common.retry`; the footer 
interpolates `home.currentVersion` with the build metadata. The new keys were 
added next to the `dashboard.*` block and the `home.brand` key respectively in 
`web/src/i18n/translations.ts`, with both `zh` and `en` entries.
   
   ### How Did You Test This Change?
   
   New test `web/src/pages/home/__tests__/HomeDashboardLocalization.test.tsx` 
renders the dashboard failure alert and the home footer with 
`rocketmq-studio-language = en` and asserts the English copy.
   
   ```powershell
   $ cd web && npx vitest run 
src/pages/home/__tests__/HomeDashboardLocalization.test.tsx
    ❯ src/pages/home/__tests__/HomeDashboardLocalization.test.tsx (2 tests | 2 
failed) 1619ms
        × renders the dashboard load failure alert in English 1250ms
        × renders the home footer version line in English 364ms
   
    FAIL  ... > renders the dashboard load failure alert in English
   Error: expect(element).toHaveTextContent()
   
   Expected element to have text content:
     Failed to load the dashboard
   Received:
     仪表盘加载失败无法获取集群概览,请检查网络连接后重试。重 试
   
    FAIL  ... > renders the home footer version line in English
   TestingLibraryElementError: Unable to find an element with the text: 
/Version \d{4}-\d{2}-\d{2} \d{2}:\d{2} build\(/u.
    Test Files  1 failed (1)
         Tests  2 failed (2)          <- before the fix
   ```
   
   ```powershell
   $ cd web && npx vitest run 
src/pages/home/__tests__/HomeDashboardLocalization.test.tsx 
src/pages/home/__tests__/HomePage.test.tsx 
src/pages/home/__tests__/DashboardPage.test.tsx 
src/pages/home/__tests__/DashboardTrafficInsights.test.tsx 
src/i18n/__tests__/translations.test.ts
    ✓ src/pages/home/__tests__/HomeDashboardLocalization.test.tsx (2 tests) 
1500ms
    ✓ src/pages/home/__tests__/HomePage.test.tsx (9 tests) 2274ms
    ✓ src/pages/home/__tests__/DashboardPage.test.tsx (6 tests) 6938ms
    ✓ src/pages/home/__tests__/DashboardTrafficInsights.test.tsx (2 tests) 
1095ms
    ✓ src/i18n/__tests__/translations.test.ts (2 tests) 17ms
    Test Files  5 passed (5)
         Tests  21 passed (21)        <- after the fix
   ```
   
   `npx tsc -b` passes and `npx eslint` reports 0 errors/0 warnings on the four 
touched files.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits
   - [x] Tests added or updated for non-trivial changes
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks) — not applicable: frontend-only change, no Java touched
   - [x] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed — not applicable: no 
documented behaviour 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