-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update latest-posts.php #5259
Update latest-posts.php #5259
Conversation
Removed unwanted space in the string
@@ -51,7 +51,7 @@ function render_block_core_latest_posts( $attributes ) { | |||
$filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) { | |||
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio']; | |||
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */ | |||
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more; | |||
return $use_excerpt ? sprintf( __( '… <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mujuonly Default WP also add space before after the excerpt content 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tempted to say that this should actually be:
if ( $use_excerpt ) {
return sprintf(
' […] <a href="%1$s" rel="noopener noreferrer">%2$s</a>',
esc_url( get_permalink() ),
__( 'Read more' )
);
} else {
return $more;
}
- Translators should not have to deal with markup in the string to be translated.
- This retains the space before and after the
...
, and adds[]
for consistency with the default in Core. - The
'Read more'
string is already translated, so we should leverage this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
I'm looking at updating the string and a couple of semi-related issues in the latest posts block over in Gutenberg in https://github.com/WordPress/gutenberg/pull/55029/files#diff-55d79982c1f505132fcff0c29e1e84b411c56fbbf5dc1c55220a530125ebf8bdR489
@SergeyBiryukov @costdev Could you please take a look. |
Translation related improvements
Text indent
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */ | ||
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more; | ||
if ( $use_excerpt ) { | ||
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */ |
The translators comment is no longer needed as only 'Read more'
is translated here, and it includes no tokens to be explained. 🙂
This was fixed in Gutenberg WordPress/gutenberg@8ef6e40 |
Removed unwanted space in the string
Trac ticket: https://core.trac.wordpress.org/ticket/59409
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.