From 8dbca77003bbc2136af46f5871df45a0d72408c7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 25 Aug 2016 23:28:24 +0200 Subject: [PATCH] Fix translatability of comments title. As per the guidelines in https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals This fixes an error notice which WPCS will start throwing once the - soon to be released - 0.10.0 version has become stable. --- comments.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/comments.php b/comments.php index c82e263..05011d5 100644 --- a/comments.php +++ b/comments.php @@ -27,11 +27,19 @@ if ( post_password_required() ) { if ( have_comments() ) : ?>

' . get_the_title() . '' - ); + $comment_count = get_comments_number(); + if ( 1 === $comment_count ) { + printf( + esc_html_e( 'One thought on “%1$s”', '_s' ), + '' . get_the_title() . '' + ); + } else { + printf( // WPCS: XSS OK. + esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', '_s' ) ), + number_format_i18n( $comment_count ), + '' . get_the_title() . '' + ); + } ?>