Repository navigation
fix(desktop): 「构建、执行、部署」设置页数量为 1 时英文改用单数 - #2318
Merged
Merged
Conversation
数量为 1 时,构建工具页、单步调试器、目录页磁贴、工具链列表、问题框和项目信任提示 不再显示 “1 pages”“1 tools · from 1 plugins”“1 need attention” 这样的英文。 沿用桌面端已有的做法:为数量 1 单独加词条,在 build_style.go 的计数函数里按数量选词条。 Refs #2317
xiaoyumuxi
marked this pull request as ready for review
November 23, 2026 04:44
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
英文界面下,「构建、执行、部署」设置页及其子页在数量为 1 时仍用复数:只装了一个带工具的插件时,目录页显示 “1 tools · from 1 plugins”,工具链列表底部显示 “1 / 1 tools”,项目信任提示显示 “1 tools come from environments inside the project … run them”。只装 Python 等单个语言插件的用户最常看到这种情况。
改动 / Changes
沿用桌面端已有做法(
desktop.status.oneProblem、desktop.references.resultCountOne):数量为 1 时用单独的词条,调用处按数量选词条。shared/i18n/features/build-settings.json:新增 10 个中英词条,并重新生成desktop/internal/i18n/shared.generated.go。kindPageCountOne:构建工具等分栏页底部 “1 page”debuggerCountOne:调试器页底部 “1 debugger”directoryDebuggersOne、directoryDebuggersOneCustomized:目录页调试器磁贴 “Stepping: 1 debugger supports filters(· customized)”directoryToolchainsOne、directoryToolchainsOneTool、directoryToolchainsOnePlugin:目录页工具链磁贴,工具数和插件数各自选单复数issuesTitleOne:目录页问题框标题 “1 needs attention”listCountOne:工具链列表底部 “{matched} / 1 tool”trustBannerOne:工具链页项目信任提示 “1 tool comes from an environment … run it”(中文同时把“它们”改为“它”)desktop/internal/settingswindow/build_style.go:新增kindPageCount、debuggerCount、steppingTileDescription、issuesTitle、toolchainsTileDescription、toolchainListCount、trustBannerText7 个函数,按数量选词条;数字仍经formatCount分组(“1,200 pages”)。build_directory_view.go(问题框标题、工具链磁贴、调试器磁贴)、build_kind_view.go(分栏页底部)、stepping_view.go(调试器页底部)、toolchains_view.go(列表底部、信任提示)。build_counts_test.go表驱动测试,覆盖英文单数和复数、两个数量的四种组合、0 和带千分位的数量,以及中文单数;build_directory_view_test.go里原来手工拼kindPageCount文案的断言改用同一个函数。docs/assets/settings-singular-counts/:修复前后对照的无头截图。保持不变的同类文案:
issuesAll、searchAllTools只在数量大于已显示行数时出现,数量至少为 2;directoryKindMore(“and 1 more”)和pending(“1 not applied”)在数量为 1 时本来就通顺。不在本 PR 范围内 / Out of scope
shared/i18n里支持按数量选词的统一机制,记录在 [Bug] 英文界面数量为 1 时仍用复数:搜索摘要 “1 matching lines in 1 files”、替换提示 “Replaced 1 occurrences.” 等约 30 处桌面端文案 #2317。类型专属:fix
复现与根因
kindPageCount同样如此。调用处直接把数量填进复数句子,没有判断数量为 1。检查项
desktop/internal/settingswindow/build_counts_test.go。测试调用的计数函数是本 PR 新增的,所以把函数里按数量判断的分支临时去掉、恢复成修复前始终用复数词条的写法来跑,11 个用例失败,例如:desktop/中的调用处都已改用新函数,或确认数量不会为 1(issuesAll、searchAllTools);没有脚本或插件引用这些 key。.agents/notes/implemented/bug-fix/记录:沿用已有的…One词条做法,没有新增约束;统一机制的取舍会在 [Bug] 英文界面数量为 1 时仍用复数:搜索摘要 “1 matching lines in 1 files”、替换提示 “Replaced 1 occurrences.” 等约 30 处桌面端文案 #2317 里定。范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:只修正已有文案的英文单复数,没有新增能力或改变跨平台行为。
插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;插件的构建步骤、资源路径和补丁没有写进docs/ci-builds.md、Agent Note 或 SkillUI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… LITHE_VISUAL_LANGUAGE=en scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow -run 'TestVisualSettings/(32-settings-build|m47-toolchain-project-untrusted)-light$';修复后在 90dd86c,修复前在 main cc16002;英文、浅色、1270×700 设置窗口(2× 渲染)。目录页工具链磁贴(修复前 → 修复后)
工具链页:未信任项目的提示和列表底部计数(修复前 → 修复后)
统一日志系统 / Structured logging
N/A:没有新增或改动生命周期、终态、降级或失败路径。
界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果,没有手改生成文件;Viva 代码通过desktop/internal/i18n/的接口读取shared/i18n/node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或扩大豁免名单逻辑归属 / Logic placement
refactorIssue:没有改可共享逻辑。性能与内存 / Performance and memory
N/A:只多一次整数比较,不涉及后台任务、子进程、缓存或热路径。
设置 / Settings
N/A:没有新增或修改设置项,只改设置页上的计数文案。
插件契约 / Plugin contract
N/A:不涉及插件契约、能力版本或宿主方法。
发行包与资源 / Bundle and resources
N/A:没有新增运行时资源或构建步骤。
无用代码与重构 / Dead code and refactoring
i18n.SharedFormat拼接已全部换成新函数,没有留下旧路径。refactor标签的 Issue,没有在本 PR 顺手处理:[Bug] 英文界面数量为 1 时仍用复数:搜索摘要 “1 matching lines in 1 files”、替换提示 “Replaced 1 occurrences.” 等约 30 处桌面端文案 #2317(各处单独加…One词条的做法是否改为统一机制,在那里决定;它是缺陷单而非refactor单)验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/settingswindow -count=1-run TestBuildCountsUseTheSingularForOne,计数函数临时恢复修复前写法scripts/desktop/desktop-go.sh vet ./internal/settingswindow、gofmt -l desktop/internal/settingswindow/node scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --checkTestVisualSettings无头截图(vivahead lithevisual,英文浅色,修复前后各一次)develop-lithe第三节插件归属自查命令未能执行的检查和原因: 没有在 Windows 上运行(这几处只改词条和按数量选词条,Windows 与 macOS 共用同一份 Go 代码,由 CI 的 Windows 检查覆盖编译和测试);没有做原生窗口验收;没有运行整个
./...测试,只跑了受影响的settingswindow包。提交前确认 / Final checks
main创建;目标分支:feat、fix、docs 为main,release 以发布流程要求为准.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图