-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix/translatable strings in theme json #8031
base: trunk
Are you sure you want to change the base?
Fix/translatable strings in theme json #8031
Conversation
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Hi @d-alleyne! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to go, thanks.
@@ -77,6 +77,20 @@ | |||
"name": "Space size name" | |||
} | |||
] | |||
}, | |||
"dimensions": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is making aspectRatios and shadow presets translatable at the block level (under settings/blocks/*
), which doesn't fix the issue. Note that the Gutenberg PR WordPress/gutenberg#66675 adds shadow presets at the top level (under settings
). Can we update this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, there's the question of whether these presets are valid at the block level. If so, they should also be translatable there. These are the differences I see:
Preset | Top | Block |
---|---|---|
color.palette | ✅ | ✅ |
color.gradients | ✅ | ✅ |
color.duotone | ✅ | ❓ |
dimensions.aspectRatios | ✅ | ❓ |
shadow.presets | ✅ | ❓ |
spacing.spacingSizes | ✅ | ✅ |
typography.fontSizes | ✅ | ✅ |
typography.fontFamilies | ✅ | ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested every combination and this is what we need to do:
- Duotone: add it to the block level.
- Dimensions.aspectRatios: add it to the block level.
- Shadow: no need to add it to the block level. It can't be defined there. If it is, the shadow UI component won't be rendered.
I've already prepared the PR in Gutenberg WordPress/gutenberg#68243 for these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, the way I tested was by adding each of those presets in Gutenberg's theme.json
file under a block (e.g.: settings.blocks.{paragraph/image/etc.}
) and verify that those presets were used at that particular block. If that's true, we need the presets to be translatable; otherwise, we don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more general thought for reference, not need to do anything in this PR. After testing how presets work at the top vs block level, I realized they work differently. In general, the approach was that a preset defined at the block level would override the top-level ones. This is no longer true for some of them. I don't know if it's intentional or an oversight. These are the ones I've tested that work differently:
- shadow: when presets are defined at the block level, the shadow UI doesn't show up
- font families: when presets are defined at the block level, both the top and the block level presets are displayed
- spacing sizes: when presets are defined at the block level, both general top spacing sizes and the block level ones are displayed
Trac ticket: https://core.trac.wordpress.org/ticket/62728
This is a backport of WordPress/gutenberg#66675 and WordPress/gutenberg#68243
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.