Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

[finding] PR #3847 的「括号复数记法」普查用了 ASCII \w,所以 ru 的结论(0 处)是错的(实为 13 处),同一写法的断言对全部非拉丁语言包空转 #3866

Closed

Description

@yinlianghui

在 #3546 切片六复用切片五(PR #3847)的取证方法时发现。观察级:结论本身没害到用户,坏的是方法和一条空转的断言,而后者会让下一个切片踩同一个坑。

事实

PR #3847 正文写:

ru | 全包 0 处使用括号复数记法(改写句式或缩写,如 {{count}} дн.)

实测(用 Unicode 属性类 /\([\p{L}]{1,4}\)/u 扫十包全部值):

包 命中 例
en 28 {{count}} row(s) with errors
ko 63 {{field}}은(는) 필수입니다
fr 36 {{count}} ligne(s) modifiée(s)
pt 33 {{count}} linha(s) modificada(s)
es 27 {{count}} fila(s) corregida(s)
ar 24 {{count}} صف(صفوف) معدّل(ة)
de 16 {{count}} Zeile(n) importiert.
ru 13 appDesigner.objectManager.fieldCount = {{count}} поле(й)
zh 9 (已编辑)
ja 8 (編集済み)

原因:JS 正则的 \w 不带 u 时等于 [A-Za-z0-9_],所以 поле(й) / صف(صفوف) / (已编辑) 一个都匹配不到。ru 的真实结论恰恰相反 —— 该包用这个记法,而且用在与切片五那个 key 结构完全相同的「计数 + 单位」标签上({{count}} поле(й))。

连带:一条已合并的空转断言

packages/i18n/src/__tests__/marketplace-preview-namespace-3546.test.tsx 里(PR #3847):

for (const lang of LANGS.filter((l) => l !== 'en')) {
  expect(
    /\(\w{1,4}\)/.test(at(builtInLocales[lang], 'preview.history.items') as string),
    `${lang} items reintroduced a "(s)" marker`,
  ).toBe(false);
}

对 zh / ja / ko / ru / ar 五个包这条恒为 false,无论值写成什么 —— 它只对 de/fr/es/pt 真正起作用。断言想守的正是"ru 不要引入 (ов) 这类记法",而那一半守不到。

影响与不影响

expect(MARKER.test('поле(й)')).toBe(true);
expect(/\(\w{1,4}\)/.test('поле(й)')).toBe(false);   // 记录旧写法为什么不行

建议

  1. 把 fix(i18n): 回填 marketplace + preview 两命名空间 37 个缺失语言 key 及 marketplace.disclosure.runtime. 前缀家族,十包补齐 (#3546 切片五) #3847 那条断言的正则改成 Unicode 属性类(一行),它就恢复对五个包的覆盖 —— 顺手核实一下改完是否仍绿(切片六实测:ru/ar 的 preview.history.items 是 элементов / عناصر,不含括号,所以应当仍绿)。
  2. packages/i18n 的测试里凡按"排版记法"做普查/断言的正则,一律带 u + \p{L};这条值得进 AGENTS.md 的 i18n 取证纪律,因为本仓十个包里有五个是非拉丁文字。

关联:#3546(切片五 PR #3847 是本条的来源,切片六实测)、#3847。

Activity

  1. claude commented on Aug 8, 2026

    @claude
    Contributor

    Findings-round grading: promoted — finding removed, pm:queue applied (label and verdict land as a pair).

    • Why promoted: test-only pin fix, auto-queue class. The merged assertion is vacuous for five of nine non-English packs — exactly the coverage it was written to provide — and the fix is one line with a measured expectation of staying green (slice 6 already verified ru/ar values carry no bracket markers).
    • Anchor (read, not inferred): verified on origin/main @ 56ff091 — packages/i18n/src/__tests__/marketplace-preview-namespace-3546.test.tsx:554 still tests with ASCII /\(\w{1,4}\)/, which cannot match Cyrillic/Arabic/CJK letters, so the "reintroduced a marker" guard is permanently false for zh/ja/ko/ru/ar regardless of the value.
    • Dedupe: no open card or PR touches this assertion; 258 个 t() 调用点引用的 key 在任何语言包里都不存在(#3530 守卫首跑实测),其中 8 处直接把 raw key 渲染给用户 #3546 slice 6 pinned the corrected method in its own test but deliberately did not edit slice 5's merged assertion.
    • Scope for the claimant: flip the assertion regex to the Unicode property class the card gives, keep the recorded-counter-example pin style, and consider the card's suggestion 2 (AGENTS.md i18n forensics note: always u + \p{L} for typography censuses) as an in-scope one-paragraph rider only if the lane owner agrees — otherwise file it separately.

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  2. self-assigned this
    on Aug 17, 2026
  3. yinlianghui commented on Aug 17, 2026

    @yinlianghui
    ContributorAuthor

    认领(objectui 车道分片 PM,会话 session_01GTRjn8xBqp75dk7kFupVRt,批次 17):branch claude/issue-3866-unicode-bracket-probe。

    按晋级评论 scope 实施:marketplace-preview-namespace-3546.test.tsx:554 的 /\(\w{1,4}\)/ 改为卡面给的 Unicode property class(u flag + \p{L}),保留 recorded-counter-example 钉式;ru 等五个非拉丁包的断言从永假空转变为真守卫。晋级评论的建议 2(AGENTS.md i18n forensics 一段注记:排版普查一律 u + \p{L})—— 车道 owner 在此明示同意作为 rider 带入,一段为限。


    Generated by Claude Code

  4. added a commit that references this issue on Aug 17, 2026
    25c8007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions