Skip to content
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 npm packages to latest versions for 6.4 Beta 3 #5439

Closed
wants to merge 1 commit into from

Conversation

mikachan
Copy link
Member

@mikachan mikachan commented Oct 9, 2023

Trac ticket: https://core.trac.wordpress.org/ticket/59411


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.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@mikachan Mostly LGTM, one concern about i18n here (@swissspidy can you advise?), and 2 non-blocking documentation nit-picks.

Comment on lines +312 to +313
*
* @return void
Copy link
Member

Choose a reason for hiding this comment

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

@return void shouldn't be used in core.

Suggested change
*
* @return void

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 1f2451f.

Copy link
Contributor

Choose a reason for hiding this comment

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

@felixarntz could you elaborate on this? Searching the codebase turns up quite a few uses of @return void. In what circumstances should it not be used?

There are a few instances across core block files, so if we do remove them we should probably do them all in one go.

Copy link
Member

Choose a reason for hiding this comment

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

@tellthemachines @mikachan Any @return void found in core were probably missed by reviewers, or reviewers weren't aware of the requirement. See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#:~:text=Note%3A%20%40return%20void%20should%20not%20be%20used%20outside%20of%20the%20default%20bundled%20themes.

If we can remove those consistently, that would be great.

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +329 to +330
*
* @return void
Copy link
Member

Choose a reason for hiding this comment

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

See above.

Suggested change
*
* @return void

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 1f2451f.

Comment on lines +154 to +160
$trimmed_excerpt .= sprintf(
/* translators: 1: A URL to a post, 2: The static string "Read more", 3: The post title only visible to screen readers. */
__( '… <a href="%1$s" rel="noopener noreferrer">%2$s<span class="screen-reader-text">: %3$s</span></a>' ),
esc_url( $post_link ),
__( 'Read more' ),
esc_html( $title )
);
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is good from a i18n perspective. Specifically:

  • Does it make sense for the to be part of the (same) translation string?
  • I think the "Read more" must not be outside of this main string, otherwise context is missing.
  • Should we move the a tag outside the translation string and wrap it instead?
  • The "Read more: {post title}" is a bit of a weird format text. Most core themes have solved this via something like sprintf( __( 'Continue reading %s' ), $title ).

Maybe something like this would be better:

Suggested change
$trimmed_excerpt .= sprintf(
/* translators: 1: A URL to a post, 2: The static string "Read more", 3: The post title only visible to screen readers. */
__( '… <a href="%1$s" rel="noopener noreferrer">%2$s<span class="screen-reader-text">: %3$s</span></a>' ),
esc_url( $post_link ),
__( 'Read more' ),
esc_html( $title )
);
$trimmed_excerpt .= '… <a href="' . esc_url( $post_link ) . '" rel="noopener noreferrer">';
$trimmed_excerpt .= sprintf(
/* translators: %s: The post title only visible to screen readers */
__( 'Continue reading <span class="screen-reader-text">%s</span>' ),
esc_html( $title )
);
$trimmed_excerpt .= '</a>';

Copy link
Member

Choose a reason for hiding this comment

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

Rule of thumb is to avoid string concatenation like in this suggestion.
The ellipsis should be part of the translatable string, which means keeping the a tag in there, too. But ses, the „Read more“ should be in there as well and not added via a placeholder.

Currently AFK, so I definitely do recommend checking similar instances in core themes and elsewhere, and asking @SergeyBiryukov or #polyglots if in doubt.

Copy link
Member Author

Choose a reason for hiding this comment

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

These suggestions make sense to me, thank you! I've addressed them here, but it would be great to get some feedback from more experienced i18n folks too.

Choose a reason for hiding this comment

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

Discussion probably could continue on GB55026.

This is a pair of similar strings. "Read more" already has been visible on the front end since 6.3, so we may need to keep that exact text in the string.

@mikachan
Copy link
Member Author

mikachan commented Oct 9, 2023

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