zhaohai666 opened a new pull request, #495: URL: https://github.com/apache/rocketmq-dashboard/pull/495
## PR Info PR Number: PR-WEB-1 Branch: pr-web-1-i18n (target repo: rocketmq-studio) Total changes: 10 files, +529 / -74 lines Commit sequence: feat → fix → test ## Objective Migrate all hardcoded Chinese UI text to i18n key reference pattern. All visible text will be dynamically resolved via the `t()` translation function to support seamless Chinese / English language switching. ## Core File Changes | File | Modification Details | |------|----------------------| | theme.ts | Replace field `label: string` with `labelKey: string`; update four mapping tables (STATUS_MAP / TOPIC_TYPE_MAP / CLUSTER_TYPE_MAP / PROTOCOL_MAP) to fully reference i18n keys | | StatusBadge.tsx | Import `useLang()` hook; replace static `config.label` with translated `t(config.labelKey)` | | translations.ts | Add around 280 new translation entries covering modules: theme, cluster, topic, group, acl, ssl, namespace, alert; remove 13 duplicated `topic.*` keys from line 680 to 718 | | dashboard.tsx | Replace cluster type column static `info.label` with translated `t(info.labelKey)` | | topic.tsx | Update 5 places: replace `.label` with `t(.labelKey)` and add fallback logic for topic type display | | consumer.tsx | Full i18n adaptation for consumer group page UI text | | cluster/index.tsx | Full i18n adaptation for cluster management page UI text | | LangContext.test.tsx | Minor test logic adjustments | ## Build Fix Commit Changes 1. Delete 13 duplicated `topic.*` translation keys (lines 680–718 in translations.ts) to resolve TS1117 duplicate property error 2. Replace deprecated `config.label` access with `t(config.labelKey)` in dashboard.tsx & topic.tsx to resolve TS2339 property missing error ## Test Commit Coverage (18 test cases total) ### StatusBadge.test.tsx (9 cases) 1. Render status badge component normally 2. Verify i18n labelKey resolution for statuses: running / warning / abnormal / offline / connecting 3. Support custom text override 4. Validate accessibility aria attributes ### theme.test.ts (9 cases) 1. Verify data structure of labelKey inside STATUS_MAP / TOPIC_TYPE_MAP / CLUSTER_TYPE_MAP / PROTOCOL_MAP 2. Ensure corresponding translation entries exist for all labelKeys -- 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]
