fix(i18n): localize pagination totals across instance and studio pages - #2973
Open
yyqdbngt wants to merge 1 commit into
Open
fix(i18n): localize pagination totals across instance and studio pages#2973yyqdbngt wants to merge 1 commit into
yyqdbngt wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Sep 2, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
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.totalRuleswas 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.totalRulesinterpolation keys (zh + en)consumer.tsx,dlq.tsx(2 spots),message.tsx,topic.tsx,UserManagement.tsx,alerts.tsxLiteTopic.tsx: replaced a manualreplace('{total}', ...)with the interpolation enginealerts.totalRulesas the plain stat label ("规则总数"/"Total Rules") and introducedcommon.totalRulesfor the paged footer, so the header stat never renders a leftover{count}placeholderWhy
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→ cleaneslinton changed files → 0 errors (only pre-existing react-refresh/exhaustive-deps warnings)