Skip to content

添加简体中文本地化与升级防回归检查#321

Open
howcity wants to merge 9 commits into
palmier-io:mainfrom
howcity:codex/zh-hans-localization-v066
Open

添加简体中文本地化与升级防回归检查#321
howcity wants to merge 9 commits into
palmier-io:mainfrom
howcity:codex/zh-hans-localization-v066

Conversation

@howcity

@howcity howcity commented Jul 14, 2026

Copy link
Copy Markdown

上游 PR 评审说明

标题:feat: 添加简体中文界面本地化

1. 改动内容

  • 增加 zh-Hans.lproj、英文源词典、InfoPlist.strings 和统一的 L10n.stringL10n.textL10n.format 入口。
  • 本地化首页、菜单、项目、设置、编辑器、媒体、字幕、生成、导出队列、Agent、Skills、通知、错误提示、辅助功能和撤销/重做动作名。
  • 保留项目名、任务名、素材名、路径、URL、命令、模型/API 名、FPS、尺寸、数值和时间码。
  • CI 增加本地化检查;新增固定 UI、未处理的动态 UI、占位符漂移、产品标识改写和受保护内容误翻会导致检查失败。
  • 已处理正式评审提出的两项问题:导出缺失素材提示按数量选择单数/复数;Mention 类型标题改用 trackLabel,避免小写 raw value 绕过词典。
  • 已处理后续评审与运行态发现:侧边栏和媒体索引状态不再原文直出;Agent 撤销不再按本地化菜单标题反查协议动作名;套餐和布局标签只在 UI 层本地化一次;生成引用类型错误使用本地化类型名;Agent 积分错误保持完整英文协议;Sequence 通知不再误标为 Video;生成占位符不再二次本地化。
  • 适配 v0.6.10 的新 Undo、Inspector、Skills 与设置结构,保留上游业务逻辑。

PR 当前本地基线:351de91d214a60faa9acc6e75630a7f77823454e;分支头:7cb8fed501a69dcf974992090b240b7ee0fe8802。稳定版交付另行移植到官方 v0.6.10,分支头为 ba12bc4b76572c6acf0ea08c2ec917ebaf43684f

2. 验证方式

node scripts/check-localization.mjs
git diff --check origin/main...HEAD
rg --files Sources Tests -g '*.swift' | sort | xargs swiftc -frontend -parse -enable-bare-slash-regex
plutil -lint Sources/PalmierPro/Resources/Localization/{en,zh-Hans}.lproj/*.strings
swift test --disable-sandbox
scripts/bundle.sh debug

最新 main 分支检查结果:1026 条固定 UI 候选、1123 条简体中文翻译,词典一致性、plist、全量 Swift 语法解析和 Git 空白检查通过。稳定版 v0.6.10 移植结果:1023 条固定 UI 候选、1123 条翻译,同样通过静态检查。

当前机器只有 /Library/Developer/CommandLineTools。标准测试先在 Metal 插件处因缺少 metal 停止;隔离 worktree 改用 macOS 26.5 SDK 并临时移除 Metal 插件后,主程序已完成编译和链接。此前测试实际运行 1070 项,其中 40 项仅涉及缺少 Metal 编译产物或本地模型;排除这些环境套件后,995 项全部通过。最终提交的撤销、Agent、积分格式和媒体类型 4 个套件、15 项定向测试全部通过。独立 QA5 App 已完成 v0.6.10 最终首页和布局菜单验收,QA4 证据覆盖设置与文件菜单。兼容改动均位于隔离临时 worktree,没有进入 PR 或交付补丁;正式合并前仍需由 macos-26 CI 或完整 Xcode 机器运行标准 Metal 测试和官方 debug App 构建。

3. 需要重点检查

  • EditorUndo 统一动作名本地化是否保持撤销/重做语义。
  • Agent undo 是否继续使用稳定英文协议结果,不依赖或暴露本地化菜单标题。
  • ExportView 单数/复数提示、MentionPopover 类型标题和生成引用类型错误是否符合英文与简中布局。
  • 套餐、布局和生成占位符是否只本地化一次,显示 → 布局 中的默认/媒体/纵向是否正确。
  • Agent 积分错误是否保持完整英文,Sequence 生成通知是否显示正确类型。
  • Inspector、Skills、设置窗口的动态标题是否只翻译固定 UI,不改用户技能名、描述和路径。
  • Resources/Localization 在 SwiftPM 与 scripts/bundle.sh 中是否保持 .lproj 目录结构。
  • 在简体中文系统中复核长文案、导出队列、设置页和 VoiceOver 标签。

Note

Medium Risk
Broad string-surface change across editor, agent, export, and menus with dual localized/non-localized code paths; regressions would show as wrong language, broken format placeholders, or agent/tool message drift rather than data loss.

Overview
Adds Simplified Chinese UI resources and routes most fixed user-facing copy through L10n.string / L10n.text / L10n.format, including menus, account/billing, export, generation, notifications, errors, and tour copy. CI and local dev now run node scripts/check-localization.mjs before tests; CONTRIBUTING points to docs/localization.md.

Agent and editor behavior is split so the UI can localize while tools keep stable English: ripple/dead-air and multicam refusal paths take a localized flag (agent calls use localized: false); CostEstimator.agentFormat stays English for agent credit errors; EditorUndo localizes undo menu titles via injectable keys but undoLatest() no longer returns the action name (agent undo message is generic English).

Other notable wiring: MediaPanelToast for structured toasts; export/queue localized status names; model validation helpers accept localized for UI vs agent; mention/media labels use trackLabel instead of raw clip types; plist/menu strings localized; user content (names, paths, models) stays unlocalized per docs.

Reviewed by Cursor Bugbot for commit 2045827. Bugbot is set up for automated code reviews on this repo. Configure here.

@howcity
howcity marked this pull request as ready for review July 14, 2026 10:18
@howcity

howcity commented Jul 14, 2026

Copy link
Copy Markdown
Author

CI 当前显示 action_required,这是首次 fork 的工作流需要维护者批准,并非测试失败。本地化检查、静态解析、74 个相关测试、补丁重放和简体中文运行态验收结果已列在 PR 描述中;烦请批准 macos-26 CI 后继续评审。

Comment thread Sources/PalmierPro/Export/ExportView.swift Outdated
Comment thread Sources/PalmierPro/Agent/Panel/MentionPopover.swift Outdated
@howcity
howcity force-pushed the codex/zh-hans-localization-v066 branch from 08b9b83 to 8783b1e Compare July 17, 2026 02:36
Comment thread Sources/PalmierPro/Editor/EditorUndo.swift Outdated
Comment thread Sources/PalmierPro/Account/AccountService.swift Outdated
Comment thread Sources/PalmierPro/Editor/EditorUndo.swift Outdated
Comment thread Sources/PalmierPro/Generation/Catalog/CostEstimator.swift
Comment thread Sources/PalmierPro/App/AppNotifications.swift
Comment thread Sources/PalmierPro/Generation/UI/GenerationView.swift Outdated

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7cb8fed. Configure here.

Comment thread Sources/PalmierPro/MediaPanel/MediaTab/MediaTab+IndexStatus.swift Outdated
Comment thread Sources/PalmierPro/Editor/ViewModel/EditorViewModel+Nesting.swift Outdated
Comment thread Sources/PalmierPro/Editor/ViewModel/EditorViewModel+Sync.swift Outdated
Comment thread Sources/PalmierPro/Generation/UI/GenerationView+References.swift
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.

1 participant