Conversation
zh-TW: 补齐缺失的 93 个键(含 Error 命名空间,经 opencc 转繁体) en/vi: 新增 Error 命名空间 36 键翻译 + 补齐 3 个非 Error 缺失键 en: prune 49 个代码未引用的死键(别名键,已 verify_en_extra 校验 0 引用) src/i18n/request.ts: 落地 fallbackLocale 深合并回退(阶段1) 孤儿 key 精扫: diagnose_i18n_keys + i18n-key-check --unused(zh-CN 5646 孤儿键待清理;226 缺失含 73 嵌套误报)
从 git 历史父版本恢复 48 个键的原始中文(46 直接恢复 + 2 消歧:k_1cy20k0=新建评审、k_1wtck8n=余料)。 其余 79 个为 Dcprint 自描述英文键(cardSelected/scanQR/uvInk 等)、Common.activate/deactivate、Hr.fillMonth、SalesReturn.selectOrder,按键名+代码上下文推断中文;仅 k_1gfnr28(成本表空态)、k_sfsp66(仓库名称) 为上下文推断待复核。 验证:i18n-key-check 代码→zh-CN 真实扁平缺失键归零(剩余 73 为脚本浅校验嵌套键误报,非真实缺口);CRLF 行尾保留;JSON 可解析。
loadMessages 改为扁平化点键(新增 flatten 辅助函数),Monitoring/trace 等嵌套命名空间的 73 个键不再误报为 missing(实测 73→0);--unused 颗粒度同步精细化(5646→5649,真正嵌套键仅 ~71 个,浅校验对 unused 虚高仅 ~3)。注:审计报告原推“--unused 降为真实 5081”系与 measure-2026-09-09.mjs 口径混淆的误判,本脚本扁平化后实测忠实值为 5649。
新增 scripts/verify-codemod-consistency.mjs:扫描 src 全部 t()/tc()/ts('key') 调用,扁平化 messages/zh-CN.json,断言每个被代码引用的键都存在于 zh-CN;缺失即视为 messages 被回退的信号并以 exit(1) 退出(纯扫描、不写文件,复用 i18n-key-check 的 BINDING_RE/CALL_RE/flatten 逻辑)。用于 codemod 后回归门禁,防止「中文丢失 / 裸 key」。
另在 scripts/i18n-codemod-p2.cjs 顶部补充提交约束注释:源文件改动与 4 个 locale 文件改动必须纳入【同一次提交】,严禁只提交 .tsx 而回退/漏提 messages(两次独立写非原子,zh-CN 作为 fallback 基被回退会全语言裸 key)。
将 P0-2 的 scripts/verify-codemod-consistency.mjs 接入提交 / CI 门禁,防止 messages/zh-CN.json(next-intl deepMerge fallback 基)被单独回退导致全语言裸 key。 ① .husky/pre-commit:在 lint-staged 之后以 `&&` 链式追加 `node scripts/verify-codemod-consistency.mjs`, lint-staged 失败仍会阻断提交(保留既有门禁);脚本只读不写,安全。 ② 新增 .github/workflows/i18n-consistency.yml:push / pull_request 到 main 时 checkout 后直接运行该脚本 (纯 Node、无外部依赖、无需 install),缺失 key 即 exit 1 阻断 CI。 验证:本地临时删除「被代码引用且全局唯一」的键 Common.k_1dm8f8t 后,hook 命令退出码 1 并精确打印该键(已字节级还原,真实 messages 未改);干净树退出码 0。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
PR 标题
变更说明
简要描述本次 PR 的改动内容。
变更类型
关联 Issue
Closes #
事件发布检查清单
persistEvents()在同一transaction()内order.clearDomainEvents()docs/印前模块文档.md/生产模块文档.md/打样模块文档.md中的事件列表(如适用)测试清单
pnpm test:unit:runpnpm test:coverage通用检查清单
pnpm lintpnpm ts-checkBreaking Changes
部署注意事项