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

Update and combine theme.json and block.json extractors #319

Merged
merged 6 commits into from
Jul 4, 2022

Conversation

swissspidy
Copy link
Member

@swissspidy swissspidy commented May 2, 2022

Uses the block-i18n.json schema file to determine which fields are translatable.

Enhancement: Adds support for translating block variation fields. Apparently these were not extracted before...

Fixes #287

@swissspidy
Copy link
Member Author

cc @gziolo

@swissspidy swissspidy added this to the 2.4.0 milestone May 2, 2022
@swissspidy
Copy link
Member Author

Looks like the existing theme i18n schema parser does not support cases like

  "keywords": [ "block keyword" ],

as seen in block.json

So that needs some fiddling to enable support and make the tests pass

@swissspidy
Copy link
Member Author

@schlessera I'm running into some fatal errors here on PHP < 7.4. Perhaps you have some ideas here? Not sure which one of my changes could have caused that...

@schlessera
Copy link
Member

@swissspidy The problem was the use of private access in the IterableCodeExtractor trait. That worked fine until you extended a class that was using that trait.

@swissspidy
Copy link
Member Author

Ah 💡 🤦 Thanks!

@swissspidy swissspidy changed the title Combine theme.json and block.json extractor classes Update and combine theme.json and block.json extractors May 3, 2022
@gziolo
Copy link
Contributor

gziolo commented May 4, 2022

I think it's a good idea to use the file from wordpress-develop for now. I'm still not sure whether using the canonical URL similar to https://schemas.wp.org/trunk/block.json as discussed in the parent issue would work so nicely as it can be ahead of WordPress core.

Anyway, it looks like this PR has everything covered. Nice work, thank you for bringing i18n schemas up to date ❤️

src/JsonSchemaExtractor.php Outdated Show resolved Hide resolved
src/JsonSchemaExtractor.php Outdated Show resolved Hide resolved
src/JsonSchemaExtractor.php Outdated Show resolved Hide resolved
src/JsonSchemaExtractor.php Show resolved Hide resolved
src/JsonSchemaExtractor.php Show resolved Hide resolved
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
@swissspidy swissspidy merged commit cd25bd6 into main Jul 4, 2022
@swissspidy swissspidy deleted the fix/287-block-schema branch July 4, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use i18n schema for block.json from WordPress Core
3 participants