Skip to content

Fix hardcoded plurals in count labels (use _n()) - #351

Merged
AllTerrainDeveloper merged 9 commits into
WordPress:trunkfrom
itzmekhokan:fix/count-label-pluralization
Jul 14, 2026
Merged

Fix hardcoded plurals in count labels (use _n())#351
AllTerrainDeveloper merged 9 commits into
WordPress:trunkfrom
itzmekhokan:fix/count-label-pluralization

Conversation

@itzmekhokan

Copy link
Copy Markdown
Contributor

Summary

Several count labels across the Desktop Mode UI were built with a single hardcoded plural string via __() + sprintf() instead of _n(), so at a count of 1 they render ungrammatically — e.g. "1 posts in this category.", "1 replies", "Replies (1)". This switches each to _n( singular, plural, number ).

Spans the Posts window (Categories, Tags, post list, Profile), the Comments window, and the Content Graph — same defect class throughout. One fix per commit.

Fixes #350.

Changes

File String Surface
src/posts-window/categories-mindmap.ts %d posts in this category. Categories — node sidebar meta
src/posts-window/categories-mindmap.ts %d posts Categories — search-result count
src/posts-window/tags-cloud.ts %d posts tagged with this. Tags — tag sidebar meta
src/posts-window/tags-cloud.ts %d posts Tags — search-result count
src/posts-window/index.ts %d comments Post list — comment-cell aria-label
src/comments-window/index.ts + %d replies Comments — replies toggle
src/content-graph/panel.ts Replies (%d) Content Graph — panel section label
src/posts-window/user-edit-render.ts + %d pages Profile — Posts stats tile sub-label
src/posts-window/user-edit-render.ts %d days Profile — "member for" stat

The Content Graph label now matches the already-correct _n( 'Reply (%d)', 'Replies (%d)', … ) in src/my-wordpress/index.ts.

Out of scope

Non-pluralizing / abbreviated %d strings are correct as-is and left untouched: %d selected, %d published, %d received, %d total, Approved %d. (no noun); %d KB, %d min/h/d ago, %d ★, %d / 100 (abbreviations/scores); #%d, Desktop %d, %d:00 (IDs/numbers); and the intentional %d post(s) / %d item(s) "(s)" shorthand. PHP %d strings are HTTP/error codes, not counts.

Testing

  • npm run build — clean
  • npm run lint — clean
  • npm run typecheck — clean
  • npm run test:js — 1821 passed

No POT/PO regeneration (batched i18n step, per contributor guide).

Use _n() instead of a hardcoded plural for the category node sidebar
meta count in the Posts window Categories mind-map.
Use _n() for the category search-result count label in the Posts
window Categories mind-map.
Use _n() instead of a hardcoded plural for the tag sidebar meta count
in the Posts window Tags cloud.
Use _n() for the tag search-result count label in the Posts window
Tags cloud.
Use _n() for the comment-count aria-label on post-list rows in the
Posts window.
Use _n() for the direct-replies count on the Comments window replies
toggle button.
Use _n( 'Reply (%d)', 'Replies (%d)', ... ) for the replies section
label in the Content Graph panel, matching the existing pattern in
the My WordPress window.
Use _n() for the pages-count sub-label on the Posts stats tile in the
user Profile view.
Use _n() for the days-since-registration value in the user Profile
stats grid.

@AllTerrainDeveloper AllTerrainDeveloper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! Thank you!

@AllTerrainDeveloper
AllTerrainDeveloper merged commit e21b684 into WordPress:trunk Jul 14, 2026
6 checks passed
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.

Hardcoded plurals in count labels render "1 posts" across Desktop Mode (needs _n())

2 participants