Skip to content

Conversation

@mujuonly
Copy link

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.

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;
Copy link
Member

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 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-09-20 at 3 05 41 PM :man-shrugging:

Copy link
Contributor

@costdev costdev Sep 20, 2023

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(
		' [&hellip;] <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.

Copy link
Member

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

@mukeshpanchal27
Copy link
Member

@SergeyBiryukov @costdev Could you please take a look.

/* 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 … */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* 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. 🙂

@swissspidy
Copy link
Member

This was fixed in Gutenberg WordPress/gutenberg@8ef6e40

@swissspidy swissspidy closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants