Five for the Future: Use _n() for the /pledges/ ranked-by-impact label#648
Five for the Future: Use _n() for the /pledges/ ranked-by-impact label#648yani- wants to merge 1 commit into
Conversation
…l so the day count is pluralized.
The "Ranked by impact, last %d days." label was wrapped in __() which forces every translation to handle the day count as plural. Switch to _n() with a singular form ("Ranked by impact, last %d day.") so locales that distinguish 1 vs N can render the singular when $window_days is 1, and so the existing plural-aware locales still get the plural form for 30/90/180.
Props iworks, dd32.
Fixes https://meta.trac.wordpress.org/ticket/8251.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Updates the /pledges/ “Ranked by impact…” label to use proper singular/plural translation handling, enabling locales to render “1 day” correctly when the window size is ever set to 1.
Changes:
- Replaced
__()with_n()for the “Ranked by impact, last %d days.” label to provide both singular and plural strings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
The
Ranked by impact, last %d days.label on/pledges/was wrapped in__(), which forces every translation to treat the day count as plural. Switch to_n()with a singular form (Ranked by impact, last %d day.) so locales that distinguish 1 vs N can render the singular when\$window_daysis 1, and existing plural-aware locales keep the plural for 30/90/180.Props iworks, dd32.
Fixes https://meta.trac.wordpress.org/ticket/8251.
Test plan
/pledges/?window=30(or 90 / 180): label reads "Ranked by impact, last 30 days." — unchanged.WINDOW_DAYS_ALLOWEDever adds 1 (or any locale renders different plural forms for these counts): the singular form is now available to translators.