Changeset 53381 for branches/6.0/src/wp-includes/blocks/comments-title.php
- Timestamp:
- 05/10/2022 04:20:59 PM (3 years ago)
- Location:
- branches/6.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0
- Property svn:mergeinfo changed
/trunk merged: 53377-53378
- Property svn:mergeinfo changed
-
branches/6.0/src/wp-includes/blocks/comments-title.php
r53338 r53381 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() ); 27 $tag_name = 'h2'; 25 $comments_count = get_comments_number(); 26 /* translators: %s: Post title. */ 27 $post_title = sprintf( __( '“%s”' ), get_the_title() ); 28 $tag_name = 'h2'; 28 29 if ( isset( $attributes['level'] ) ) { 29 30 $tag_name = 'h' . $attributes['level']; … … 34 35 } 35 36 36 $single_default_comment_label = $show_post_title ? __( 'Response to' ) : __( 'Response' );37 37 if ( $show_comments_count ) { 38 $single_default_comment_label = $show_post_title ? __( 'One response to' ) : __( 'One response' ); 38 if ( $show_post_title ) { 39 if ( '1' === $comments_count ) { 40 /* translators: %s: Post title. */ 41 $comments_title = sprintf( __( 'One response to %s' ), $post_title ); 42 } else { 43 $comments_title = sprintf( 44 /* translators: 1: Number of comments, 2: Post title. */ 45 _n( 46 '%1$s response to %2$s', 47 '%1$s responses to %2$s', 48 $comments_count 49 ), 50 number_format_i18n( $comments_count ), 51 $post_title 52 ); 53 } 54 } elseif ( '1' === $comments_count ) { 55 $comments_title = __( 'One response' ); 56 } else { 57 $comments_title = sprintf( 58 /* translators: %s: Number of comments. */ 59 _n( '%s responses', '%s responses', $comments_count ), 60 number_format_i18n( $comments_count ) 61 ); 62 } 63 } elseif ( $show_post_title ) { 64 if ( '1' === $comments_count ) { 65 /* translators: %s: Post title. */ 66 $comments_title = sprintf( __( 'Response to %s' ), $post_title ); 67 } else { 68 /* translators: %s: Post title. */ 69 $comments_title = sprintf( __( 'Responses to %s' ), $post_title ); 70 } 71 } elseif ( '1' === $comments_count ) { 72 $comments_title = __( 'Response' ); 73 } else { 74 $comments_title = __( 'Responses' ); 39 75 } 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 76 59 77 return sprintf(
Note: See TracChangeset
for help on using the changeset viewer.