Skip to content

Options, Meta APIs: Support plural forms for count labels in Settings. - #12731

Open
t-hamano wants to merge 1 commit into
WordPress:trunkfrom
t-hamano:29299-plural-forms-in-settings
Open

Options, Meta APIs: Support plural forms for count labels in Settings.#12731
t-hamano wants to merge 1 commit into
WordPress:trunkfrom
t-hamano:29299-plural-forms-in-settings

Conversation

@t-hamano

Copy link
Copy Markdown
Contributor

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.

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>
Copilot AI review requested due to automatic review settings July 28, 2026 09:12
@t-hamano
t-hamano marked this pull request as ready for review July 28, 2026 09:12
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props wildworks.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +192 to +193
'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.)'
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

2 participants