Skip to content

fix: convert hardcoded plural-glue labels to i18nT count keys (#5820) - #5876

Merged
bolichen97 merged 1 commit into
mainfrom
fix/template-literal-plural-glue-5820
Aug 26, 2026
Merged

fix: convert hardcoded plural-glue labels to i18nT count keys (#5820)#5876
bolichen97 merged 1 commit into
mainfrom
fix/template-literal-plural-glue-5820

Conversation

@CrysisDeu

Copy link
Copy Markdown
Collaborator

Summary

Ten user-visible sites still built count labels with fully hardcoded template-literal plural glue (${n} issue${n === 1 ? '' : 's'}) or its uninflected sibling (${n} more) — the plural decision made in JS, in English, outside any translate call — so every non-English locale rendered mixed-language text. This is the follow-up conversion pass that issue #5820 enumerated after PR #5811 merged; the conversion follows #5811's pattern exactly.

Converted sites (each now one i18nT(key, { count }) call):

Surface Label
App.tsx nav overflow toggle "Show N more apps" title and the visible "N more" label
App.tsx notification bell "N notifications" title
AppsPage.tsx "Updated N apps." success message
issue-radar TaggingView "Labelled N issues[; M could not be updated]" banner (both branches), "Apply N suggestions" button
issue-radar LabelsPanel "N open issues" chip title (with- and no-description branches)
issue-radar PrList "N files changed" diff-stat title
file-explorer SearchPanel "N results" status line + "(capped)" suffix

Catalog changes: ten new plural bases across all 12 catalogs with categories exactly per each language's own Intl.PluralRules (ru 4 forms, es/fr/it/pt 3, en/de/hi/bn 2, zh-CN/ja/ko 1), registered in pluralKeys.json, plus one plain key; en-XA regenerated. The SearchPanel count reuses the existing components.discoverySearchBar.result base instead of duplicating it (shared-owner notes at both sites).

WCAG 2.5.3 (Label in Name): the nav overflow toggle's accessible name now equals its visible label while the label is shown; converting only the aria-label would have localized the name while the visible text stayed English, letting the two diverge in every non-English locale. Collapsed (icon-only) mode keeps the fuller "Show N more apps" name.

Ceiling: [plurals-hardcoded] ratchets down 37 → 7, the count the gate itself reports post-conversion. The detector lib is untouched — widening it is #5818 / PR #5832. The remaining 7 hits are model-directed prompt text (CommentOverlay, ArtifactDetailPage, design-tweak prompts), deliberately English.

Screenshots

Real SearchPanel component (mocked search seam only), result count through the converted key:

en zh-CN ru
en zh-CN ru

English rendering is byte-identical at every converted site (verified per-site against the old ternaries, including the 0-count and 1-count edges).

Testing

Closes #5820

@CrysisDeu
CrysisDeu requested a review from a team August 25, 2026 13:01
@CrysisDeu
CrysisDeu requested a review from a team as a code owner August 25, 2026 13:01
@CrysisDeu
CrysisDeu requested a review from cixuuz August 25, 2026 13:01
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 94342b365e18114ef2e01da12ff2cbe4a9b9edfd — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Correct root-cause fix: the plural decision moves inside the translate call, catalogs carry each language's own categories, and the detector ceiling ratchets down with the conversion.

Suggestions

  • SearchPanel.tsx still assembles the status line in JS — i18nT('…result', {count}) + ' ' + i18nT('…capped'); a language that wants the qualifier fronted or the punctuation changed can't express it, and the plural gate can't see this shape. A second plural base (result_capped) selected by truncated removes the last English-grammar decision at the one site this PR rewrites.

[DESIGN-REVIEWED] 94342b3

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 94342b365e18114ef2e01da12ff2cbe4a9b9edfd and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 94342b3

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 94342b365e18114ef2e01da12ff2cbe4a9b9edfd: <one-sentence reason>

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of 94342b365e18114ef2e01da12ff2cbe4a9b9edfd — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Ten mixed-language count labels now render fully localized, English output stays byte-identical, and the screenshots confirm the en/zh-CN/ru renderings pixel-for-pixel.

[UX-REVIEWED] 94342b3

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 94342b365e18114ef2e01da12ff2cbe4a9b9edfd — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

This is a clean, mechanical i18n conversion. All inventory items trace to the documented invariant (never hardcode a user-facing string) and the [plurals-hardcoded] ceiling ratchet. The shared-key reuse and deferred-sibling tracking are genuine. I confirmed the discoverySearchBar.result reuse (2 consumers: DiscoverySearchBar.tsx:78, SearchPanel.tsx:73) and that temp-screenshots/ has an established cleanup workflow.

First-Principles-Verdict: PASS

Ten hardcoded English plural labels become locale-correct i18nT calls under a documented invariant; every site removes real mixed-language rendering and nothing rides along undeclared.

What this change ships

Intent: stop non-English locales rendering English plural glue at ten count-label sites — a FIX.

  1. Nav overflow "N more" label localized — justified
  2. Nav overflow "Show N more apps" title localized — justified
  3. Nav toggle aria-label now equals the visible label (WCAG 2.5.3) — justified, declared
  4. Notification bell "N notifications" title localized — justified
  5. AppsPage "Updated N apps." message localized — justified
  6. TaggingView "Labelled N issues[; M failed]" banner localized — justified
  7. TaggingView "Apply N suggestions" button localized — justified
  8. LabelsPanel "N open issues" chip title localized — justified
  9. PrList "N files changed" title localized — justified
  10. SearchPanel "N results (capped)" localized, reusing components.discoverySearchBar.result — justified, not a duplicate

Supporting (not user-facing): catalog plural bases across 12 locales + pluralKeys.json, en-XA regen, ceiling 37→7, a shared-owner comment on DiscoverySearchBar.

Each new key has exactly one call site — expected for translation keys, not premature generalization. Zero option at any site = mixed-language text for non-English users (named harm). Remaining 7 hardcoded hits and the detector widening are deferred to #5818/#5832, so no unfixed sibling rides here.

[FIRST-PRINCIPLES-REVIEWED] 94342b3

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 94342b365e18114ef2e01da12ff2cbe4a9b9edfd — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 94342b3

Verdict parsed from the review's SHA-scoped output markers for commit 94342b365e18114ef2e01da12ff2cbe4a9b9edfd.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 94342b365e18114ef2e01da12ff2cbe4a9b9edfd: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Aug 25, 2026
Ten user-visible sites still built their count labels with fully hardcoded
template-literal plural glue (`${n} issue${n === 1 ? '' : 's'}`) or its
uninflected sibling (`${n} more`) — the label assembled in JS, in English,
entirely outside any translate call — so every non-English locale rendered
mixed-language text. Sites converted, per the pattern PR #5811 established:

- App.tsx: the nav overflow toggle's "Show N more apps" title and its visible
  "N more" label, and the notification bell's "N notifications" title
- AppsPage.tsx: the "Updated N apps." success message
- issue-radar TaggingView: the "Labelled N issues[; M could not be updated]"
  banner (both branches) and the "Apply N suggestions" button
- issue-radar LabelsPanel: the "N open issues" chip title, in both its
  with-description and no-description branches
- issue-radar PrList: the "N files changed" diff-stat title
- file-explorer SearchPanel: the "N results" status line and its "(capped)"
  truncation suffix

Each site now passes the count into one i18nT(key, { count }) call. The
SearchPanel count reuses the existing components.discoverySearchBar.result
base rather than duplicating it (both sites carry a shared-owner note); the
other sites add ten new plural bases with per-language plural forms across
all 12 catalogs (categories exactly per each language's own Intl.PluralRules:
ru 4 forms, es/fr/it/pt 3, en/de/hi/bn 2, zh-CN/ja/ko 1), registered in
pluralKeys.json, plus one plain key, with en-XA regenerated.

The nav overflow toggle's accessible name now equals its visible label while
the label is shown (WCAG 2.5.3 Label in Name): converting only the aria-label
would have localized the name while the visible text stayed English, letting
the two diverge in every non-English locale. Its title keeps the fuller
"Show N more apps" phrasing for icon-only (collapsed) mode.

The [plurals-hardcoded] growth-only ceiling ratchets down 37 -> 7, the count
the gate itself reports after the conversion (the detector lib is untouched;
widening it is #5818 / PR #5832).

The remaining detector hits are model-directed prompt text (CommentOverlay,
ArtifactDetailPage, design-tweak prompts), which is deliberately English and
not user-visible locale copy.

Closes #5820
@CrysisDeu
CrysisDeu force-pushed the fix/template-literal-plural-glue-5820 branch from f88fb88 to 94342b3 Compare August 25, 2026 17:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Aug 25, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) August 26, 2026 04:20
@bolichen97
bolichen97 merged commit 7b3c657 into main Aug 26, 2026
66 checks passed
@bolichen97
bolichen97 deleted the fix/template-literal-plural-glue-5820 branch August 26, 2026 04:33
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n: template-literal plural-glue sites outside the #5784 grep list (~9 sites)

2 participants