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
This commit is contained in:
parent
b0fe9f059c
commit
de18e6c5a2
|
@ -59,8 +59,7 @@ $twenty_twenty_one_comment_count = get_comments_number();
|
||||||
<?php
|
<?php
|
||||||
the_comments_pagination(
|
the_comments_pagination(
|
||||||
array(
|
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,
|
'mid_size' => 0,
|
||||||
'prev_text' => sprintf(
|
'prev_text' => sprintf(
|
||||||
'%s <span class="nav-prev-text">%s</span>',
|
'%s <span class="nav-prev-text">%s</span>',
|
||||||
|
|
|
@ -223,37 +223,31 @@ if ( ! function_exists( 'twenty_twenty_one_the_posts_navigation' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function twenty_twenty_one_the_posts_navigation() {
|
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(
|
the_posts_pagination(
|
||||||
array(
|
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,
|
'mid_size' => 0,
|
||||||
'prev_text' => sprintf(
|
'prev_text' => sprintf(
|
||||||
'%s <span class="nav-prev-text">%s</span>',
|
'%s <span class="nav-prev-text">%s</span>',
|
||||||
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
|
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
|
||||||
sprintf(
|
wp_kses(
|
||||||
/* translators: %s: The post-type name. */
|
__( 'Newer <span class="nav-short">posts</span>', 'twentytwentyone' ),
|
||||||
esc_html__( 'Newer %s', 'twentytwentyone' ),
|
array(
|
||||||
'<span class="nav-short">' . esc_html( $post_type_name ) . '</span>'
|
'span' => array(
|
||||||
|
'class' => array(),
|
||||||
|
),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'next_text' => sprintf(
|
'next_text' => sprintf(
|
||||||
'<span class="nav-next-text">%s</span> %s',
|
'<span class="nav-next-text">%s</span> %s',
|
||||||
sprintf(
|
wp_kses(
|
||||||
/* translators: %s: The post-type name. */
|
__( 'Older <span class="nav-short">posts</span>', 'twentytwentyone' ),
|
||||||
esc_html__( 'Older %s', 'twentytwentyone' ),
|
array(
|
||||||
'<span class="nav-short">' . esc_html( $post_type_name ) . '</span>'
|
'span' => array(
|
||||||
|
'class' => array(),
|
||||||
|
),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
|
is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
|
||||||
),
|
),
|
||||||
|
|
|
@ -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_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_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_next_label = esc_html__( 'Next post', 'twentytwentyone' );
|
||||||
$twentytwentyone_post_type_name = '';
|
$twentytwentyone_previous_label = esc_html__( 'Previous post', 'twentytwentyone' );
|
||||||
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 );
|
|
||||||
|
|
||||||
the_post_navigation(
|
the_post_navigation(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue