Repository navigation
Conversation
The "Load more" count used `__( 'Showing %1$s of %2$s media items' )`, which reads "Showing 1 of 1 media items" for a single media item and gives translators no plural forms. Its translators comment was above `sprintf()`, so it was not extracted. Use `_n()` with the plural form following the total, and move the comment above the `_n()` call. Adds a QUnit test for the count text. See #66357.
|
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. |
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. |
The "Load more" count in the Media Library showed
__( 'Showing %1$s of %2$s media items' ). The English string is always plural, so a library with one media item showed "Showing 1 of 1 media items", and translators had a single form for every count. Its translators comment sat abovesprintf()instead of the translation call, somake-potdid not extract it.This uses
_n(), with the plural form following the total, and moves the comment directly above the_n()call.make-potnow extracts the comment and both forms, frombrowser.jsand from the builtwp-includes/js/media-views.js. Existing translations of the old string do not carry over to the new pair.Adds a QUnit test (
test-attachments-browser.js) that runsupdateLoadMoreView()for one of one and one of two media items and checks the text. It fails on trunk and passes with the change. The suite wraps each test in fake timers, butupdateLoadMoreView()is an underscore debounce that measures its wait with the realDate.now(), so the test switches to real timers, cancels any pending call and runs one update at a time.Tested in a browser on WordPress 7.1.3, whose
updateLoadMoreView()is identical to trunk, with infinite scrolling turned off in the user profile (the count only shows then): one media item now shows "Showing 1 of 1 media item", two show "Showing 2 of 2 media items".Trac ticket: https://core.trac.wordpress.org/ticket/66357
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: Investigation, implementation, QUnit test, browser verification, and PR wording. I reviewed the reasoning and test results, and I take responsibility for the contribution.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.