-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Themes: Translate custom templates in theme.json #29828
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
Conversation
|
Size Change: 0 B Total Size: 1.4 MB ℹ️ View Unchanged
|
cacf117 to
b416996
Compare
|
According to #28410 (comment) it looks like |
They aren't translatable today. We can't tell what the future brings but it's better to keep them structured the same way as |
oandregal
left a comment
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 see there's some conflicts with the theme-json docs. Other than that this is ready.
Special thanks for taking the time to add a new test for this! This should increase our confidence levels by an order of magnitude.
|
Oh, just remembered one thing: when there're changes to the theme.json format I usually create the corresponding PR in theme-experiments (or let the themers know what changes are upcoming). |
Thanks for the reminder. I thought about that when I was testing changes with |
b416996 to
255e734
Compare
|
I opened PR for TT1-blocks theme: WordPress/theme-experiments#232 |
carolinan
left a comment
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.
With this PR I can't get the "postTypes": [ "page", "post" ] setting to work. The template is only available for pages.
It's my last refactoring where I made it explicit what is sourced from the config file and I forgot to list |
255e734 to
1c20e0e
Compare
@carolinan, it should be fixed now. |
65efc6b to
0d410ee
Compare
|
This PR somehow caused an issue with missing items in theme.json files 🤔 |
|
I think I might introduce a regression there around presets. I will improve our test coverage first and see how to fix it. |
Description
An alternative to #28783. The difference is that rather than changing the way translatable fields are marked in
experimental-18n-theme.json, the structure ofexperimental-theme.jsonforcustomTemplatesandtemplatePartsgets updated to fit the i18n extracting logic. It also aligns with how settings are declared like color palettes for font sizes.Before
{ "templateParts": { "header": { "area": "header" }, "footer": { "area": "footer" } } }After
{ "templateParts": [ { "name": "header", "area": "header" }, { "name": "footer", "area": "footer" } ] }#27778 introduced a new field in the
theme.jsonfile, thecustomTemplatesto declare custom page templates to be shown to the user in places like:#28700 integrated the processing of that field into the
WP_Theme_JSON/WP_Theme_JSON_Resolverclasses. This is the next step of that integration: make it translatable.Changes:
experimental-i18n-theme.json, so wp-cli can understand what needs to be translated.WP_Theme_JSON_Resolverto retrieve the translated version of this field.How has this been tested?
tt1-blockstheme.experimental-theme.jsonfile to contain:In addition to that, a new unit test was added to cover translation logic applied to
theme.json.Screenshots
Types of changes
New feature (non-breaking change which adds functionality).
Checklist: