Skip to content

Commit d2c7431

Browse files
argszeroargszero
andauthored
docs(i18n): drop the stale per-update count log from the gate comment (#180)
`src/i18n_pack.rs`'s positive-control comment block described "本次更新" with the numbers of the release that wrote it (the sharing 本月新增 card: 783 -> 786 keys, 531 -> 535 call sites, 426 -> 429 distinct) while the six constants directly beneath it read 785 / 785 / 330 / 305 / 537 / 430. C2015 wrote that narrative and C2019 moved the constants to 785/537/430 without touching it, so the comment has contradicted its own code for two commits. Why it survived: only the comment was wrong. The constants are internally consistent, so `cargo test` stayed green throughout — there is no assertion on prose. Fix: delete the per-update narrative and keep only the orientation-independent rule (calibrate against the extractor's real output, never hand-compute), which cannot rot. Each cycle's delta belongs to the commit history (`git log -p src/i18n_pack.rs`), not to a copy maintained in the file. The replacement block deliberately contains no "old -> new" notation: in this position that notation reads as an assertion about the current value, and the constants below are the only authority for that. (Writing the clean-up this way first re-created the confusion it removes — the checker flagged the fix itself.) Also records which set T_LITERAL_COUNT counts: it is the T() call-site total, neither the key count nor the distinct count (three different sets). Comment-only change: src/i18n_pack.rs is a #[cfg(test)]-only module, so no production behaviour changes and no constants move. 165 tests pass. Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
1 parent a366162 commit d2c7431

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

‎src/i18n_pack.rs‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@ const EN_END: &str = "\n };";
3232
/// 阳性对照真值:**改动语言包/前端文案时应刻意更新这些数字**。
3333
/// 它们的作用是把「提取器静默失真」与「语言包真的变了」区分开(见 `packs()`)。
3434
///
35-
/// 本次更新(共享页「本月新增」卡):783 → 786 = **+3 键**
36-
/// (`share.stats.newthis{,.sub,.none}`),531 → 535 / 426 → 429 = **+4 个 `T()` 字面量调用点 / +3 个去重键**
37-
/// (卡片 1 个 + 副标题三元 3 个:单个模型取模型名不上键、多个 / 空各 1 个 `T()`,共 4 处调用 3 个新键)。
38-
/// `STATIC_ATTR_*` 不变:本次未改 `ui/index.html` 的静态属性(仅 cache-bust 串)。
35+
/// ⚠️ 加数时**别口算**:C2013 先把增量估成 +6(漏了 `fmtUptime` 里的重复调用),
36+
/// 门禁把真值报了出来。改动后请以提取器的实际输出校准,再核对是否与 diff 相符:
37+
/// 先让门禁报出真值、再照抄,**不要**先写一个自己算的数。
3938
///
40-
/// 上一轮(运营概览「服务版本 / 运行时长」两张卡):775 → 783 键,520 → 531 / 418 → 426。
39+
/// ⚠️ 这里**不记录「本次改了多少」**(C2024):那段叙述只在写下它的那一次提交里正确,
40+
/// 下一次改语言包的人会改这 6 个常量,却几乎不会想起回来改注释 —— 注释就会在一行之隔
41+
/// 自相矛盾。真实发生过:C2015 按当时实得把键数写成 786,C2019 把常量改成 785 而未动注释,
42+
/// 相隔仅两个提交;`cargo test` 全程是绿的,因为**错的只是注释**(常量本身自洽)。
43+
/// **每一轮的增量属于提交历史**(`git log -p src/i18n_pack.rs`),不在文件里维护副本;
44+
/// 这里只留「改的时候怎么做」的规则,它不随版本腐烂。
4145
///
42-
/// ⚠️ 加数时**别口算**:C2013 我先把增量估成 +6(漏了 `fmtUptime` 里的重复调用),
43-
/// 是这条阳性对照把 531 报了出来。改动后请以提取器的实际输出校准,再核对是否与 diff 相符。
44-
/// 本轮实测的校准路径就是这条规则:783/531/426 三处**依次**报出 786 → 535 → 429,
45-
/// 每一步都是先让门禁报出真值、再照抄,而不是先写一个自己算的数。
46+
/// ⚠️ 因此本段刻意不含任何「旧值 → 新值」写法:那种写法读起来就是在断言当前值,
47+
/// 而当前值只有下面这 6 个常量是权威。历史请查 `git log -L 32,52:src/i18n_pack.rs`。
48+
///
49+
/// ⚠️ `T_LITERAL_COUNT` 是 `T("…")` **调用点**总数,不是键数,也不是去重后的键数 ——
50+
/// 三个集合各不相同(坑 99);说「这个数不该变」之前先确认它在数哪个集合。
4651
const ZH_KEY_COUNT: usize = 785;
4752
const EN_KEY_COUNT: usize = 785;
4853
const STATIC_ATTR_COUNT: usize = 330;

0 commit comments

Comments
 (0)