From de18e6c5a2da6e879d5b4ff2b1a9fdb55655fbfd Mon Sep 17 00:00:00 2001 From: desrosj Date: Tue, 22 Dec 2020 16:15:06 +0000 Subject: [PATCH] Twenty Twenty-One: Improve strings found in post navigations for easier translating. This change adjusts strings found within post navigations to ensure translators are provided the full context needed to properly translate. Props poena, SergeyBiryukov, aristath. Fixes #52047. Built from https://develop.svn.wordpress.org/trunk@49866 git-svn-id: http://core.svn.wordpress.org/trunk@49585 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/twentytwentyone/comments.php | 3 +- .../twentytwentyone/inc/template-tags.php | 36 ++++++++----------- wp-content/themes/twentytwentyone/single.php | 17 ++------- wp-includes/version.php | 2 +- 4 files changed, 19 insertions(+), 39 deletions(-) diff --git a/wp-content/themes/twentytwentyone/comments.php b/wp-content/themes/twentytwentyone/comments.php index 85f538031d..edb96c7e43 100644 --- a/wp-content/themes/twentytwentyone/comments.php +++ b/wp-content/themes/twentytwentyone/comments.php @@ -59,8 +59,7 @@ $twenty_twenty_one_comment_count = get_comments_number(); esc_html__( 'Page ', 'twentytwentyone' ), + 'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ', 'mid_size' => 0, 'prev_text' => sprintf( '%s %s', diff --git a/wp-content/themes/twentytwentyone/inc/template-tags.php b/wp-content/themes/twentytwentyone/inc/template-tags.php index 38add801c5..35c428bfad 100644 --- a/wp-content/themes/twentytwentyone/inc/template-tags.php +++ b/wp-content/themes/twentytwentyone/inc/template-tags.php @@ -223,37 +223,31 @@ if ( ! function_exists( 'twenty_twenty_one_the_posts_navigation' ) ) { * @return void */ function twenty_twenty_one_the_posts_navigation() { - $post_type = get_post_type_object( get_post_type() ); - $post_type_name = ''; - if ( - is_object( $post_type ) && - property_exists( $post_type, 'labels' ) && - is_object( $post_type->labels ) && - property_exists( $post_type->labels, 'name' ) - ) { - $post_type_name = $post_type->labels->name; - } - the_posts_pagination( array( - /* translators: There is a space after page. */ - 'before_page_number' => esc_html__( 'Page ', 'twentytwentyone' ), + 'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ', 'mid_size' => 0, 'prev_text' => sprintf( '%s %s', is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ), - sprintf( - /* translators: %s: The post-type name. */ - esc_html__( 'Newer %s', 'twentytwentyone' ), - '' . esc_html( $post_type_name ) . '' + wp_kses( + __( 'Newer posts', 'twentytwentyone' ), + array( + 'span' => array( + 'class' => array(), + ), + ) ) ), 'next_text' => sprintf( '%s %s', - sprintf( - /* translators: %s: The post-type name. */ - esc_html__( 'Older %s', 'twentytwentyone' ), - '' . esc_html( $post_type_name ) . '' + wp_kses( + __( 'Older posts', 'twentytwentyone' ), + array( + 'span' => array( + 'class' => array(), + ), + ) ), is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) ), diff --git a/wp-content/themes/twentytwentyone/single.php b/wp-content/themes/twentytwentyone/single.php index a0c6d2b10a..c550e64b81 100644 --- a/wp-content/themes/twentytwentyone/single.php +++ b/wp-content/themes/twentytwentyone/single.php @@ -36,21 +36,8 @@ while ( have_posts() ) : $twentytwentyone_next = is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ); $twentytwentyone_prev = is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ); - $twentytwentyone_post_type = get_post_type_object( get_post_type() ); - $twentytwentyone_post_type_name = ''; - if ( - is_object( $twentytwentyone_post_type ) && - property_exists( $twentytwentyone_post_type, 'labels' ) && - is_object( $twentytwentyone_post_type->labels ) && - property_exists( $twentytwentyone_post_type->labels, 'singular_name' ) - ) { - $twentytwentyone_post_type_name = $twentytwentyone_post_type->labels->singular_name; - } - - /* translators: %s: The post-type singular name (example: Post, Page, etc.) */ - $twentytwentyone_next_label = sprintf( esc_html__( 'Next %s', 'twentytwentyone' ), $twentytwentyone_post_type_name ); - /* translators: %s: The post-type singular name (example: Post, Page, etc.) */ - $twentytwentyone_previous_label = sprintf( esc_html__( 'Previous %s', 'twentytwentyone' ), $twentytwentyone_post_type_name ); + $twentytwentyone_next_label = esc_html__( 'Next post', 'twentytwentyone' ); + $twentytwentyone_previous_label = esc_html__( 'Previous post', 'twentytwentyone' ); the_post_navigation( array( diff --git a/wp-includes/version.php b/wp-includes/version.php index 58e13eb26f..09193a88cd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-49865'; +$wp_version = '5.7-alpha-49866'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.