diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index 1e00589cec..29c7b85de2 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -34,6 +34,7 @@ __ = wp.i18n.__, _x = wp.i18n._x, _n = wp.i18n._n, + _nx = wp.i18n._nx, sprintf = wp.i18n.sprintf; wp = wp || {}; @@ -970,6 +971,8 @@ var $form = $( '#bulk-action-form' ), $views = $( '.subsubsub' ), $pluginRow = $( this ), + $currentView = $views.find( '[aria-current="page"]' ), + $itemsCount = $( '.displaying-num' ), columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length, pluginDeletedRow = wp.template( 'item-deleted-row' ), /** @@ -977,7 +980,8 @@ * * @type {Object} */ - plugins = settings.plugins; + plugins = settings.plugins, + remainingCount; // Add a success message after deleting a plugin. if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) { @@ -1057,6 +1061,17 @@ $form.find( '#the-list' ).append( '' + __( 'No plugins are currently available.' ) + '' ); } } + + if ( $itemsCount.length && $currentView.length ) { + remainingCount = plugins[ $currentView.parent( 'li' ).attr('class') ].length; + $itemsCount.text( + sprintf( + /* translators: %s: The remaining number of plugins. */ + _nx( '%s item', '%s items', 'plugin/plugins', remainingCount ), + remainingCount + ) + ); + } } ); wp.a11y.speak( _x( 'Deleted!', 'plugin' ) ); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index f804a50a93..12a842a026 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1340,7 +1340,7 @@ function wp_default_scripts( $scripts ) { $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); $scripts->set_translations( 'privacy-tools' ); - $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 ); + $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize', 'wp-i18n' ), false, 1 ); $scripts->set_translations( 'updates' ); did_action( 'init' ) && $scripts->localize( 'updates',