Options, Meta APIs: Support plural forms for count labels in Settings. - #12731
Options, Meta APIs: Support plural forms for count labels in Settings.#12731t-hamano wants to merge 1 commit into
Conversation
The `posts` and `items` labels on the Reading Settings screen, and the comment spam link count string on the Discussion Settings screen, were single hardcoded strings, forcing translators into whichever plural form they guessed at. Wrap them in `_n_noop()` and resolve them with `translate_nooped_plural()` against the saved option value, and add translator comments. Also replaces `form_option()` with an escaped `get_option()` call for the two number fields, since the values are now needed as integers. Props shailu25, GaryJ, SergeyBiryukov, pavelevap, johnbillion. See #29299. Co-Authored-By: Claude <noreply@anthropic.com>
|
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
This PR updates several Settings screen count labels to use proper plural translation handling, so the label text can reflect the configured numeric value (and be correctly localized).
Changes:
- Reading Settings: Replace fixed “posts/items” labels with plural-aware translations based on the saved option values.
- Discussion Settings: Switch the “%s or more links” moderation string to use plural-aware translation handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/wp-admin/options-reading.php |
Uses plural-aware translation for the “post(s)” and “item(s)” labels following numeric fields. |
src/wp-admin/options-discussion.php |
Converts the “Hold a comment… %s or more links” text to a plural-aware string selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'Hold a comment in the queue if it contains %s or more link. (A common characteristic of comment spam is a large number of hyperlinks.)', | ||
| 'Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)' |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/29299
Use of AI Tools
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.