Repository navigation
feat(localization): 缺中文的 key 由机器人机翻草稿补齐,不再卡 PR - #611
Merged
Merged
Conversation
…hinese The en/zh parity check in check:i18n assumed both source dictionaries are hand-written; in the agent-driven workflow a missing zh-CN entry is an oversight, not a decision, and should get the same machine-translation backstop as the other 53 locales. - draft-missing-chinese.mjs finds keys present in the English sources but absent from every Chinese source, translates them through the same Google endpoint with the same placeholder/protected-token validation, and writes drafts into the real sources (zh-CN.ts root dictionary or additional-zh-CN.json) so import, parity checks, and PR review all see them. - Both translation workflows run the draft step before importing; the PR workflow reports the drafted keys in a best-effort PR comment. - check:i18n downgrades en/zh gap reports to informational output; duplicate keys remain hard failures. - Shared google-translate.mjs / web-locale-sources.mjs modules keep the two existing scripts' behavior identical (verified: import stays idempotent, catalogs unchanged, 19/19 localization tests pass).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
背景
#608 落地后仍有不一致:新文案只写英文时,53 个语言由机器人机翻补齐,唯独 zh-CN 被
check:i18n的 en/zh 奇偶校验硬卡住。在 agent 生成文案的工作流里,缺中文是疏忽而非决策,应享受同样的机翻兜底。设计修订见 docs/design/translation-catalog-automation.md 第 7 节。改动
draft-missing-chinese.mjs(新增):找出"英文源有、中文源无"的 key(TS 字典 + additional JSON 都覆盖),走同一 Google 端点机翻 zh 草稿(同样的占位符/受保护 token/非空校验),写回真实源文件(zh-CN.ts根部 /additional-zh-CN.json)。草稿进入源后,import、parity、PR 评审都按正常内容对待。zh-CN.ts;PR 工作流推送后尝试gh pr comment列出机翻草稿 key 清单供人工润色(评论失败只警告不影响主流程)。check-i18n.mjs:en/zh 缺口从硬失败降为信息输出;重复 key 仍硬失败。google-translate.mjs(端点调用)与web-locale-sources.mjs(TS 字典解析)抽取复用,既有两脚本行为不变。验证
draft-missing-chinese.test.mjs:无网络桩覆盖无缺口 no-op、两类容器补齐、二次运行幂等、占位符丢失/空译文 fail-closedcheck-catalogs通过;import 幂等无 diff;check-i18n通过{"drafted":[]}(无缺口)