From d72e4fd9aa2c6cea8c8e4422d366abcc917a29cc Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 3 Oct 2017 17:12:41 +0000 Subject: [PATCH] Plugins: Introduce a singular and plural form for the plugin deletion error message. Props eddhurst, SergeyBiryukov Fixes #38918 git-svn-id: https://develop.svn.wordpress.org/trunk@41713 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/plugin.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index 97dd767850..69aeacda2f 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -891,8 +891,17 @@ function delete_plugins( $plugins, $deprecated = '' ) { set_site_transient( 'update_plugins', $current ); } - if ( ! empty($errors) ) - return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s.'), implode(', ', $errors)) ); + if ( ! empty( $errors ) ) { + if ( 1 === count( $errors ) ) { + /* translators: %s: plugin filename */ + $message = __( 'Could not fully remove the plugin %s.' ); + } else { + /* translators: %s: comma-separated list of plugin filenames */ + $message = __( 'Could not fully remove the plugins %s.' ); + } + + return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) ); + } return true; }