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

Add a "translators:" comment in the core class used to implement a Block widget #34840

Merged
merged 2 commits into from
Sep 16, 2021

Conversation

amieiro
Copy link
Contributor

@amieiro amieiro commented Sep 15, 2021

This comment is intended to facilitate the translation of the plugin, which is incorporated in the WordPress core, so that its translation is not ambiguous.

See https://core.trac.wordpress.org/ticket/54110

This PR has been sent to WordPress develop. See this PR.

Description

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @amieiro! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Sep 15, 2021
Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

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

Sounds good to me.

@talldan @draganescu for awareness (I'll merge tomorrow if no one brings up anything).

@@ -197,6 +197,7 @@ public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->default_instance );
?>
<p>
/* translators: HTML code of the block, not an option that blocks HTML */
Copy link
Member

@SergeyBiryukov SergeyBiryukov Sep 15, 2021

Choose a reason for hiding this comment

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

Thanks for the PR!

I don't think this exact code would work, as we're inserting a PHP comment inside an HTML <p> tag.

We can also replace echo __() with _e() while we're at it.

I would suggest something like this to match a similar change for WordPress core in r51814:

<label for="<?php echo $this->get_field_id( 'content' ); ?>">
	<?php
	/* translators: HTML code of the block, not an option that blocks HTML. */
	_e( 'Block HTML:', 'gutenberg' );
	?>
</label>

Following the commit integrated in the WordPress core
https://core.trac.wordpress.org/changeset/51814
I move the comment near the text to be translated
and update the translation function used
@ntsekouras ntsekouras merged commit 41fbf20 into WordPress:trunk Sep 16, 2021
@github-actions
Copy link

Congratulations on your first merged pull request, @amieiro! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 11.6 milestone Sep 16, 2021
@mcsf mcsf added the Internationalization (i18n) Issues or PRs related to internationalization efforts label Sep 27, 2021
@mcsf mcsf changed the title Add a comment in the core class used to implement a Block widget Add a "translators:" comment in the core class used to implement a Block widget Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Internationalization (i18n) Issues or PRs related to internationalization efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants