[wp-trac] [WordPress Trac] #55081: WordPress wp_get_document_title() does not do RTL.
WordPress Trac
noreply at wordpress.org
Fri Feb 4 21:18:59 UTC 2022
#55081: WordPress wp_get_document_title() does not do RTL.
--------------------------+------------------------------
Reporter: jsmoriss | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: | Focuses: rtl
--------------------------+------------------------------
Comment (by jsmoriss):
Replying to [comment:2 SergeyBiryukov]:
>
> As far as I know, for RTL locales there is no need to reverse the order
in cases like this, text direction takes care of that.
The text translation, and it's direction, will be correct for each
element. This is an array of text strings that is simply imploded. ie.:
Before:
{{{
/**
* Filters the parts of the document title.
*
* @since 4.4.0
*
* @param array $title {
* The document title parts.
*
* @type string $title Title of the viewed page.
* @type string $page Optional. Page number if paginated.
* @type string $tagline Optional. Site description when on
home page.
* @type string $site Optional. Site title when not on home
page.
* }
*/
$title = apply_filters( 'document_title_parts', $title );
$title = implode( " $sep ", array_filter( $title ) );
/**
* Filters the document title.
*
* @since 5.8.0
*
* @param string $title Document title.
*/
$title = apply_filters( 'document_title', $title );
}}}
And after this patch:
{{{
/**
* Filters the parts of the document title.
*
* @since 4.4.0
*
* @param array $title {
* The document title parts.
*
* @type string $title Title of the viewed page.
* @type string $page Optional. Page number if paginated.
* @type string $tagline Optional. Site description when on
home page.
* @type string $site Optional. Site title when not on home
page.
* }
*/
$title = apply_filters( 'document_title_parts', $title );
// Make sure the parts are ordered in a predictable left-to-right
sequence.
$title = array_merge( array( 'title' => null, 'page' => null,
'site' => null, 'tagline' => null ), $title );
// If this is a right-to-left language, reverse the order of the
parts.
if ( is_rtl() ) {
$title = array_reverse( $title );
}
$title = implode( " $sep ", array_filter( $title ) );
/**
* Filters the document title.
*
* @since 5.8.0
*
* @param string $title Document title.
*/
$title = apply_filters( 'document_title', $title );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55081#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list