From bc5bdffa3ce08aa4abb6c5c6250df79e6f6015b0 Mon Sep 17 00:00:00 2001 From: devansh016 Date: Wed, 21 Aug 2024 14:12:58 +0530 Subject: [PATCH] Replace _n() with simpler code --- plugins/performance-lab/includes/admin/plugins.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index eb69aca044..b468d9d469 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -146,12 +146,18 @@ static function ( string $file ) { $error_messages = array_unique( $error_messages ); + if ( count( $error_messages ) === 1 ) { + $error_text = __( 'Failed to query WordPress.org Plugin Directory for the following plugin:', 'performance-lab' ); + $error_occurred_text = __( 'The following error occurred:', 'performance-lab' ); + } else { + $error_text = __( 'Failed to query WordPress.org Plugin Directory for the following plugins:', 'performance-lab' ); + $error_occurred_text = __( 'The following errors occurred:', 'performance-lab' ); + } + wp_admin_notice( - '

' . esc_html( - _n( 'Failed to query WordPress.org Plugin Directory for the following plugin:', 'Failed to query WordPress.org Plugin Directory for the following plugins:', count( $errors ), 'performance-lab' ) - ) . '

' . + '

' . esc_html( $error_text ) . '

' . $plugin_list . - '

' . esc_html( _n( 'The following error occurred:', 'The following errors occurred:', count( $error_messages ), 'performance-lab' ) ) . '

' . + '

' . esc_html( $error_occurred_text ) . '

' . '