…4884)
Commandment #-1 covers code comments, not just user-facing text. The sequel to
#4021 / PR #4883, which cleared the same package's `QuickFilterBar.tsx`: the six
remaining non-test source files carried 163 lines of Chinese in JSDoc, trailing
`//` notes and JSX comment blocks. All 163 are now English.
Where a comment named a UI label it now points at the `gantt.*` bundle key that
actually resolves it, rather than quoting a Chinese literal no call site holds:
`gantt.toolbar.saveLayout`, `gantt.toolbar.refresh`, `gantt.menu.removeDependency`,
`gantt.menu.addPredecessor` / `addSuccessor`, `gantt.menu.view`, `gantt.column.start`
/ `end`, `gantt.conflict.confirm` / `cancel`, `gantt.autoScheduleDlg.none`. Same
class of staleness PR #4883 fixed for the quick-filter labels.
Two facts corrected to match the code as it stands:
- The drag-conflict dialog's comment block sat above the auto-schedule dialog
(`pendingAutoSchedule`); the dialog it describes is ~60 lines further down at
`pendingConflict`. Moved back over its own JSX.
- `ObjectGantt.tsx`'s `timeSegments` JSDoc example used Chinese band labels. The
example now uses English labels, matching `ShiftBandConfig.label`'s own doc in
`shifts.ts`; the doc states explicitly that `label` is caller-localized display
text, which is what the example is illustrating.
Also removed one CJK bracket pair that `\p{Han}` does not match, so the package's
non-test sources are clean under both a Han scan and a CJK-punctuation scan.
Comment-only: every one of the six files is byte-identical after stripping
comments with the TypeScript compiler, so no code, type, or string changed.
Co-authored-by: Claude <noreply@anthropic.com>
Fixes#4884
诫条 #-1 覆盖的是代码注释,不只是面向用户的文案。本 PR 是 #4021 / PR #4883 的同形续集 —— 那一单清掉了同包
QuickFilterBar.tsx,本单清掉packages/plugin-gantt/src下其余六个非测试源码文件共 163 行中文注释(JSDoc、行尾//、JSX 注释块)。前提复核(stale-premise)
立卡时 origin/main 是
718ca9d45,本 PR 基线是372d9f9b4(即 PR #4883 的合并提交)。逐文件重扫,六文件行数与卡内清单逐一吻合,合计 163,前提成立。QuickFilterBar.tsx已不在非测试命中列表内(#4883 已清)。逐文件 Han 计数 before / after
GanttView.tsxObjectGantt.tsxshifts.tsscheduling.tsResourceWorkload.tsxworkload.ts复现:
rg -c '\p{Han}' packages/plugin-gantt/src --glob '!*.test.*'—— 改后零命中,无声明例外。包内其余非测试源码(
index.tsx、useGanttTranslation.ts、QuickFilterBar.tsx)顺扫零残留,所以六文件即全集。额外:
\p{Han}扫不到的一处GanttView.tsx:3725的「→」用的是 CJK 括号(Unicode 类别 Po,不是 Han),卡内那条rg '\p{Han}'扫不到它,163 这个数因此是偏低的。已一并改成`→`,并补扫 CJK 标点/全角区(U+3000-303F、U+FF00-FFEF、U+FE10-FE1F)确认归零。记一笔:若后续真要建门,判据不能只有\p{Han}。按现状改写处(注释与代码现状矛盾)
1. 引用 UI 字面量的注释 → 改指真实 bundle 键
这些注释引用的中文按钮/菜单文案,现已由
useGanttTranslation.ts的gantt.*键解析(英文默认值),注释里的中文literal 早已不对应任何调用点 —— 与 #4883 修 quick-filter labels 的同一类过期。改写后直接指键:"保存布局"(2 处:persistLayoutKeyJSDoc、GanttLayoutJSDoc)gantt.toolbar.saveLayout"移除依赖"gantt.menu.removeDependency手动刷新gantt.toolbar.refresh"添加紧前/紧后"(2 处)gantt.menu.addPredecessor/gantt.menu.addSuccessor查看(context menu / focus 注释)gantt.menu.view开始/结束 labelsgantt.column.start/gantt.column.end自动顺延/取消保留gantt.conflict.confirm/gantt.conflict.cancel无需排程gantt.autoScheduleDlg.none2. 注释块贴错了 JSX(位置漂移)
GanttView.tsx里拖拽冲突 → 顺延确认 (Group 2)这段注释,贴在pendingAutoSchedule(自动排程对话框)上方,而它描述的冲突对话框在约 60 行之后的pendingConflict处 —— 两段注释叠在同一个 JSX 上,下面那段才是对的。已把冲突对话框的注释移回pendingConflict上方,自动排程那段留在原位。纯注释挪位,零行为。3.
ObjectGantt.tsxJSDoc 代码示例的取舍(216-217)卡内点名的
label: '白班'/label: '夜班'是 JSDoc 代码示例,不是运行期取值。二选一里我选了改成英文示例('Day shift'/'Night shift'),理由三条:ShiftBandConfig.label,而shifts.ts里该字段自己的 JSDoc 我也改成了'Day shift' / 'Night shift';同一个字段在两个文件里给出不同语言的示例是新的不一致。label是「caller 已本地化的显示文本」,所以英文标签与中文标签作为示例同样真实,不存在失真;示例要传达的信息是key/label/start/end这四个键的结构。QuickFilterLabels时,对同类中文示例字面量的处置就是移除/英文化,而非保留。顺带在该 JSDoc 里补了一句
label是 caller 已本地化文本,让示例的英文标签不被误读成硬编码默认值。其余中文按语义译,不逐字直译;仓内统一术语:
顺延一律作forward-only(与该模块既有英文 "moved later, never pulled earlier" 一致),仅查看作view-only,写后回读作write-readback,排班日/白班/夜班作shift-day / day shift / night shift。验证
注释-only 的机械证明(比测试更强的判据):用 TypeScript 编译器对六个文件做
removeComments转译,改前(HEAD)与改后逐文件比对 —— 六个文件全部 byte-identical,即代码/类型/字符串一个字节没动:测试(
pnpm --filter @object-ui/plugin-gantt test,先--filter '@object-ui/plugin-gantt^...' build备好依赖):type-check(
turbo run type-check --filter @object-ui/plugin-gantt):Tasks: 14 successful, 14 total。lint:
0 errors(259 warnings 全部落在未改动的index.tsx/vitest.config.ts,与 main 同)。门:
check-control-bytesOK(4370 文件);check-changeset-presence/no-major/fixed均 OK。另按字节纪律对六文件自扫grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f]'—— 零命中。反向验证:如实记录方向
无门可红。仓内没有任何门机械强制诫条 #-1 的英文注释条款(#4884 正文已 grep 证实
eslint.config.js与scripts/下都没有对应规则),#4021 也已证同一点。所以「把中文改回去看测试变红」在本单不可能成立 —— 没有任何断言读注释。判据只能是:changeset
.changeset/gantt-source-comments-english.md,空 frontmatter —— 声明「不发布任何东西」,这是该门的显式豁免而非绕行,与 PR #4883 同形。范围
⛔ 未动测试文件(其中文夹具字面量是被验证的数据,#4021 正文已裁明,归维护者定,不属本单);⛔ 未动行为代码;⛔ 未动运行期字符串(复核确认非测试源码里没有中文运行期字符串);⛔ 未动
content/docs/releases/。「仓内无门强制该条款」的机制化半边不在本单(属门禁强度,归维护者),按派发要求留在卡内记录。
Generated by Claude Code