Make WordPress Core


Ignore:
Timestamp:
05/10/2022 04:20:59 PM (3 years ago)
Author:
hellofromTonya
Message:

Editor: Update WordPress packages for 6.0 RC 2.

[53377] Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 1.

[53378] Includes cherry-picked commit from the Gutenberg plugin that fix a bug discovered just before WordPress 6.0 RC 2.

Props zieladam, ndiego, kebbet, hellofromTonya.
Merges [53377] and [53378] to the 6.0 branch.
Fixes #55567.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/blocks/comments-title.php

    r53338 r53381  
    2323    $show_comments_count = ! empty( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'];
    2424    $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';
    2829    if ( isset( $attributes['level'] ) ) {
    2930        $tag_name = 'h' . $attributes['level'];
     
    3435    }
    3536
    36     $single_default_comment_label = $show_post_title ? __( 'Response to' ) : __( 'Response' );
    3737    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' );
    3975    }
    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_title
    57     );
    5876
    5977    return sprintf(
Note: See TracChangeset for help on using the changeset viewer.