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

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   `useLang().t()` interpolates parameters with `text.replace('{key}', 
String(v))`. JavaScript treats `$&`, `` $` ``, `$'` and `$$` in a *string* 
replacement specially, so any parameter value containing those sequences is 
rewritten: a rule copied from a topic literally named `cost$&` shows up as 
`cost{name}`-style corruption in the interpolated message. Passing a replacer 
function instead (`text.replace('{key}', () => String(v))`) inserts the value 
literally with no other behaviour change.
   
   Base is `rocketmq-studio` per CONTRIBUTING.md (the PR template's base 
comment is outdated).
   
   ### How Did You Test This Change?
   
   `cd web && npx vitest run src/i18n/__tests__/LangContext.test.tsx` — 10/10 
pass, including new cases asserting that parameter values containing `$&`, 
`$$`, `` $` `` and `$'` render verbatim in both Chinese and English, and that 
plain interpolation is unchanged.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes (new interpolation 
tests, zh + en)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(n/a — no new UI text)
   - [x] Architecture constraints stay green (n/a — no Java change)
   - [x] New source files carry the ASF license header (n/a — no new source 
file)
   - [x] Documentation touched where behaviour changed (code comment added)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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