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

Read More: Add example preview #68288

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

yogeshbhutkar
Copy link
Contributor

Part of: #64707

What, Why & How?

This PR introduces an example preview for the Read More block.

Testing Instructions

  1. Navigate to Global Inserter
  2. Hover over the Read More block and notice the new preview.

Screenshots

Before After
Screenshot 2024-12-25 at 2 48 13 PM Screenshot 2024-12-25 at 2 48 30 PM

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review December 25, 2024 09:39
Copy link

github-actions bot commented Dec 25, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: ramonjd <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@yogeshbhutkar
Copy link
Contributor Author

Hi @t-hamano,
I've implemented a missing block preview for the Read More block here. Could you please review this PR when you have a moment?

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Read More Affects the Read More Block labels Dec 27, 2024
@t-hamano
Copy link
Contributor

t-hamano commented Dec 27, 2024

@yogeshbhutkar Thanks for the PR!

@aaronrobertshaw @ramonjd

I noticed that the block example is not being translated. For example, in the Read more block in this PR, the default text in Japanese when the block is inserted is 続きを読む, whereas the example block displays Read more:

example

From my understanding, the example field in block.json cannot be translated currently.

If the examples contain content that may be localized, should the examples be defined in the JS code instead of in block.json?

export const settings = {
	icon,
	edit,
	example: {
		attributes: {
			content: _x( 'Read more', 'Example text for the Read More block' ),
		},
	},
};

This issue may occur in other blocks as well.

@ramonjd
Copy link
Member

ramonjd commented Dec 29, 2024

If the examples contain content that may be localized, should the examples be defined in the JS code instead of in block.json?

That should work! Seems there are other instances of blocks with translated example content:

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/button/index.js#L22-L22

@yogeshbhutkar
Copy link
Contributor Author

yogeshbhutkar commented Dec 30, 2024

Thanks, @t-hamano for reviewing the PR, and @ramonjd for providing the examples. I've implemented the suggested changes in the latest commit. However, I've found some blocks using example text that is not translated.

  • comments-pagination-next
  • comments-pagination-previous
  • post-navigation-link
  • query-no-results
  • table-of-contents

I'll update it as a comment inside the original issue so we can track this.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

image

@t-hamano t-hamano merged commit d463dbb into WordPress:trunk Dec 30, 2024
64 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.0 milestone Dec 30, 2024
@yogeshbhutkar
Copy link
Contributor Author

Thanks for the approval @t-hamano.

Here are the PRs that should incorporate translation-ready strings as per the comment mentioned above.

Can you please take a look at these PRs whenever you get a moment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Read More Affects the Read More Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants