Repository navigation
fix(ui): Market Pulse 敞口单元格工具提示使用译文而非 {t(...)} 字面量 - #238
Merged
Merged
Conversation
`ImpactRow` 把 `t()` 写进了字符串字面量:
`title="{t('today.watchlistWeightShare')}"`。JSX 不会对属性里的 `{}` 求值,
于是工具提示逐字显示模板原文,而不是译文 —— 且不随语言切换变化。
去掉引号改为 JSX 表达式,复用既有的 `today.*` 资源。
在既有 `MarketPulse.test.tsx` 中新增 1 例断言 `title` 属性:
修复前 5 pass / 1 fail → 修复后 6 pass / 0 fail。
helsome
approved these changes
Oct 18, 2026
helsome
left a comment
Owner
There was a problem hiding this comment.
本轮独立源码审查及精确 HEAD focused 11/0 通过。最新main累计组合完整测试1959 pass / 7 skip / 0 fail,全workspace typecheck、i18n通过,secret扫描零命中。仅按本PR声明范围验收,不把离线回归当真实模型/生产API验收。
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.
问题与修复
MarketPulse的ImpactRow(packages/ui/src/components/pulse/MarketPulse.tsx:133、:137)把t()写进了字符串字面量:JSX 属性里的
title="{...}"是普通字符串,{t('...')}不会被求值 —— 悬停工具提示逐字显示模板原文,而且不随语言切换变化(t从未被调用)。这两个键的译文其实早已存在:packages/i18n/src/locales/en-US/today.ts:69-70。修复:去掉引号,改为 JSX 表达式。
同文件上方的正确写法随处可见(例如
AnswerBlockFrame.tsx:70、:80的title={tip})。Closes #237
可复现测试报告
环境:Windows 11 / Bun 1.4.2;本地基线 = 上游 main
ba5dcdfd31b162f5edb8b908f7f099a560389326(2026-09-24T11:05:17Z),工作树已按 main 字节对齐。在既有
packages/ui/src/components/pulse/MarketPulse.test.tsx中新增 1 例(沿用该文件已有的clientWithPulse(SNAPSHOT)夹具,快照里两条personalImpact分别覆盖「两种敞口都有」与「只有自选敞口」):bun test ./packages/ui/src/components/pulse/MarketPulse.test.tsx修复前的具体不符:新用例的
titles.every((tip) => tip === 'Watchlist weight share' || tip === 'Portfolio exposure')得到false—— 实际title属性是{t('today.watchlistWeightShare')}/{t('today.portfolioExposure')}原文。硬门禁:
bun run typecheck—— core / i18n / shared / ui / electron 五个工作区全部 exit 0。bun test packages/ui --isolate—— 全绿(对齐 main 的本机基线 + 本轮新增用例)。未运行的测试:未跑
bun test --isolate全量(本机 6 核 / 8GB 负载下超时抖动明显,且本 PR 只动packages/ui);apps/electrone2e 未跑,本机沙箱无法 spawncmd.exe(已知环境限制)。UI 变化
「What matters to me」区块里两个敞口单元格的悬停工具提示,从
{t('today.watchlistWeightShare')}/{t('today.portfolioExposure')}变为译文Watchlist weight share/Portfolio exposure(zh-CN 下显示中文)。单元格文本、布局、样式与 DOM 结构均无变化;无新增依赖;未改动任何公共导出面。