Conversation
Removed unwanted space in the string
| $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.
@mujuonly Default WP also add space before after the excerpt content 🤔
There was a problem hiding this comment.
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.
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.
| /* 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.