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

theme.json: add title key to i18n schema #39936

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

oandregal
Copy link
Member

@oandregal oandregal commented Mar 31, 2022

Follow-up to #39322 and #39715
Related WordPress trunk PR at WordPress/wordpress-develop#2483

What?

This PR adds title as a new key to translate from a theme.json file. It's necessary to fix the wp-cli i18n-command tests at wp-cli/i18n-command#306

Why?

The title key from a style variation is shown to the user, hence, it needs to be translatable.

How?

By adding the key to the i18n schema we allow the i18n-command from the wp-cli to pick it up. See wp-cli/i18n-command#306 Though the wp-cli uses the schema from WordPress trunk so we also need to port the changes there.

Testing Instructions

This PR only prepares the code for the wp-cli to pick up translations, so there's nothing to test other than verifying that it doesn't break anything. This is what I did:

  • Go to "Settings > General" and set the language to Spanish.
  • Use TwentyTwentyTwo.
  • Load the site editor.
  • Verify that the color palettes names show up in Spanish (go to "Global Styles > Colors > Palette" and hover over the color circles.

@oandregal oandregal self-assigned this Mar 31, 2022
@oandregal oandregal added Internationalization (i18n) Issues or PRs related to internationalization efforts Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Mar 31, 2022
@oandregal oandregal changed the title themejson: add title key to i18n schema theme.json: add title key to i18n schema Mar 31, 2022
@youknowriad
Copy link
Contributor

Something I was wondering, we probably need to wrap the "title" property in __ somewhere around here right?

$variation = ( new WP_Theme_JSON_Gutenberg( $decoded_file ) )->get_raw_data();
if ( empty( $variation['title'] ) ) {
$variation['title'] = basename( $path, '.json' );
}
$variations[] = $variation;

@oandregal
Copy link
Member Author

oandregal commented Mar 31, 2022

Something I was wondering, we probably need to wrap the "title" property in __ somewhere around here right?

Yeah, we need to do other things for it to be picked up. I've already started looking into this, but I also want to fast-track the schema update and the corresponding WordPress trunk PR to unblock the i18n-command PR wp-cli/i18n-command#306

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

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

Everything is 👌.

markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Mar 31, 2022
This is related to Gutenberg changes in WordPress/gutenberg#39936 that marks the "title" key as translatable field in "theme.json" files.

See also #54336.

Props oandregal.




Built from https://develop.svn.wordpress.org/trunk@53038


git-svn-id: http://core.svn.wordpress.org/trunk@52627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott pushed a commit to gMagicScott/core.wordpress-mirror that referenced this pull request Mar 31, 2022
This is related to Gutenberg changes in WordPress/gutenberg#39936 that marks the "title" key as translatable field in "theme.json" files.

See also #54336.

Props oandregal.




Built from https://develop.svn.wordpress.org/trunk@53038


git-svn-id: https://core.svn.wordpress.org/trunk@52627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@oandregal oandregal merged commit adb77bd into trunk Mar 31, 2022
@oandregal oandregal deleted the update/theme-json-i18n-schema branch March 31, 2022 11:27
@github-actions github-actions bot added this to the Gutenberg 13.0 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Internationalization (i18n) Issues or PRs related to internationalization efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants