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 gettext content when translating 'Header'. #51066

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

gonzomir
Copy link
Contributor

@gonzomir gonzomir commented May 29, 2023

Fixes #51063.

What?

Use _x() with appropriate context when translating the word 'Header'.

Why?

The word 'Header' appears in different context in both Gutenberg and core, which makes it hard to translate.

How?

Add context to translatable strings when the context requires different translations.

Testing Instructions

Not sure about that, couldn't find information on how Gutenberg translation files are generated.

@priethor priethor added [Type] Enhancement A suggestion for improvement. Internationalization (i18n) Issues or PRs related to internationalization efforts [Package] Interface /packages/interface labels May 30, 2023
@@ -59,7 +59,7 @@ function InterfaceSkeleton(

const defaultLabels = {
/* translators: accessibility text for the top bar landmark region. */
header: __( 'Header' ),
header: _x( 'Header', 'header landmark area' ),
Copy link
Member

Choose a reason for hiding this comment

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

Hi @gonzomir thank you for this enhancement 👍 We are missing the import of the _x function in import { __ } from '@wordpress/i18n'; line 14, but other than that the PR looks good.

@gonzomir
Copy link
Contributor Author

@jorgefilipecosta Sorry for taking me so long to add the requested changes, let me know if anything else is required.

@t-hamano
Copy link
Contributor

@gonzomir Thanks for the PR.

From what I've researched, the word Header appears to be translatable depending on the context, at least on GlotPress. The screenshot below shows the Japanese translation in WordPress 6.3.

header

As you can see, the word Header without context can be translated differently than the same word with context.

Are there any steps to actually check the problem being proposed this time?

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

It seems like this PR is better than what we had on trunk and adds some context, so I'm going to merge it.

@jorgefilipecosta jorgefilipecosta enabled auto-merge (squash) January 16, 2024 14:14
@jorgefilipecosta jorgefilipecosta merged commit f6db631 into WordPress:trunk Jan 16, 2024
47 of 48 checks passed
@github-actions github-actions bot added this to the Gutenberg 17.6 milestone Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Package] Interface /packages/interface [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Header' used in i18n functions without gettext context
4 participants