Skip to content

fix(i18n): localize pagination totals across instance and studio pages - #2973

Open
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-pagination-totals
Open

fix(i18n): localize pagination totals across instance and studio pages#2973
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-pagination-totals

Conversation

@yyqdbngt

@yyqdbngt yyqdbngt commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Replace hard-coded Chinese pagination total texts across the instance and studio pages with localized t() calls, and add the corresponding translation entries:

  • common.totalUsers / common.totalGroups / common.totalMessages / common.totalRules interpolation keys (zh + en)
  • Applied in consumer.tsx, dlq.tsx (2 spots), message.tsx, topic.tsx, UserManagement.tsx, alerts.tsx
  • LiteTopic.tsx: replaced a manual replace('{total}', ...) with the interpolation engine
  • Kept alerts.totalRules as the plain stat label ("规则总数"/"Total Rules") and introduced common.totalRules for the paged footer, so the header stat never renders a leftover {count} placeholder

Why

Pagination totals were hard-coded Chinese strings (共 ${n} 个 Group), so the English UI still showed Chinese in the table footers. One change (alerts.totalRules) originally re-purposed a key that is also rendered without arguments as a header stat, which would have leaked a literal {count} into the header; this PR splits the two uses.

Testing

  • vitest run src/i18n/__tests__/LangContext.test.tsx src/pages/ops/__tests__/AlertsPage.test.tsx src/pages/studio/__tests__/UserManagement.test.tsx → 3 files, 32 tests passed (interpolation in both languages, no leftover placeholders, alerts stat + paged footer)
  • tsc --noEmit → clean
  • eslint on changed files → 0 errors (only pre-existing react-refresh/exhaustive-deps warnings)

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR successfully localizes pagination totals across the instance and studio pages, replacing hard-coded Chinese strings with proper i18n interpolation. The changes are well-structured with comprehensive test coverage (32 tests), proper separation of concerns, and no breaking changes.

Key improvements:

  • Added 4 new translation keys with proper interpolation support
  • Fixed a bug where alerts.totalRules was being used for both header stat and pagination footer
  • Good test coverage ensures no regression in localization behavior

LGTM — clean implementation with solid test coverage.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants