Changeset 53377 for trunk/src/wp-includes/blocks/comments-title.php
- Timestamp:
- 05/10/2022 02:47:10 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/comments-title.php
r53338 r53377 23 23 $show_comments_count = ! empty( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount']; 24 24 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); 25 $ post_title = $show_post_title ? sprintf( '"%1$s"', get_the_title() ) : null;26 $ comments_count = number_format_i18n( get_comments_number() );25 $comments_count = get_comments_number(); 26 $post_title = '“' . get_the_title() . '”'; 27 27 $tag_name = 'h2'; 28 28 if ( isset( $attributes['level'] ) ) { … … 34 34 } 35 35 36 $single_default_comment_label = $show_post_title ? __( 'Response to' ) : __( 'Response' );37 36 if ( $show_comments_count ) { 38 $single_default_comment_label = $show_post_title ? __( 'One response to' ) : __( 'One response' ); 37 if ( $show_post_title ) { 38 if ( '1' === $comments_count ) { 39 /* translators: %s: Post title. */ 40 $comments_title = sprintf( __( 'One response to %s' ), $post_title ); 41 } else { 42 $comments_title = sprintf( 43 /* translators: 1: Number of comments, 2: Post title. */ 44 _n( 45 '%1$s response to %2$s', 46 '%1$s responses to %2$s', 47 $comments_count 48 ), 49 number_format_i18n( $comments_count ), 50 $post_title 51 ); 52 } 53 } elseif ( '1' === $comments_count ) { 54 $comments_title = __( 'One response' ); 55 } else { 56 $comments_title = sprintf( 57 /* translators: %s: Number of comments. */ 58 _n( '%s responses', '%s responses', $comments_count ), 59 number_format_i18n( $comments_count ) 60 ); 61 } 62 } elseif ( $show_post_title ) { 63 if ( '1' === $comments_count ) { 64 /* translators: %s: Post title. */ 65 $comments_title = sprintf( __( 'Response to %s' ), $post_title ); 66 } else { 67 /* translators: %s: Post title. */ 68 $comments_title = sprintf( __( 'Responses to %s' ), $post_title ); 69 } 70 } elseif ( '1' === $comments_count ) { 71 $comments_title = __( 'Response' ); 72 } else { 73 $comments_title = __( 'Responses' ); 39 74 } 40 $single_comment_label = ! empty( $attributes['singleCommentLabel'] ) ? $attributes['singleCommentLabel'] : $single_default_comment_label;41 42 $multiple_default_comment_label = $show_post_title ? __( 'Responses to' ) : __( 'Responses' );43 if ( $show_comments_count ) {44 $multiple_default_comment_label = $show_post_title ? __( 'responses to' ) : __( 'responses' );45 }46 47 $multiple_comment_label = ! empty( $attributes['multipleCommentsLabel'] ) ? $attributes['multipleCommentsLabel'] : $multiple_default_comment_label;48 49 $comments_title = '%1$s %2$s %3$s';50 51 $comments_title = sprintf(52 $comments_title,53 // If there is only one comment, only display the label.54 '1' !== $comments_count && $show_comments_count ? $comments_count : null,55 '1' === $comments_count ? $single_comment_label : $multiple_comment_label,56 $post_title57 );58 75 59 76 return sprintf(
Note: See TracChangeset
for help on using the changeset viewer.