-
Notifications
You must be signed in to change notification settings - Fork 795
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 missing block translations #33546
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
775b24f
to
54a282a
Compare
@@ -30,7 +30,7 @@ type BlockSettingsProps = { | |||
}; | |||
|
|||
export const isAiAssistantSupportExtensionEnabled = | |||
window?.Jetpack_Editor_Initial_State.available_blocks?.[ AI_ASSISTANT_SUPPORT_NAME ]; | |||
window?.Jetpack_Editor_Initial_State?.available_blocks?.[ AI_ASSISTANT_SUPPORT_NAME ]; |
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.
Required to avoid exception being thrown.
@@ -7,8 +7,6 @@ import './editor.scss'; | |||
import './components/feedback/style.scss'; | |||
|
|||
registerJetpackBlockFromMetadata( metadata, { | |||
// The API version needs to be explicitly specified in this instance for styles to be loaded. | |||
apiVersion: metadata.apiVersion, |
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.
Not required anymore.
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render' ), | ||
) | ||
); | ||
add_action( |
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.
Wrap blocks registration in an init action callback.
// `editorScript` is required for block.json to be valid and WordPress.org to be able | ||
// to parse it before building the page at https://wordpress.org/plugins/jetpack/. | ||
// Don't add other scripts or styles while block assets are still enqueued manually | ||
// in the backend. | ||
const result = { | ||
...metadata, | ||
editorScript: `file:../${ scriptName }.js`, | ||
editorScript: `jetpack-blocks-editor`, |
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.
Prevent multiple asset downloads for now since the script is loaded manually on the backend. An editorScript
key is required for the block.json
file to be valid and for WordPress.org to be able to parse it.
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 seems to test well for me. 🚢
You'll need one last rebase to be able to merge though.
54a282a
to
67d9cbe
Compare
This PR work was originally done in #33326 but had to be reverted in #33431. It makes the exact same changes except that the
editorScript
key inblock.json
is now a script handle instead of a file path. This prevents multiple asset downloads.Fixes p1694788078746839-slack-CDLH4C1UZ
Proposed changes:
#32698, #32815, and #33073 introduced localization issues for simple sites: block titles and descriptions were displayed in English no matter the user's selected language. This PR fixes it.
The blocks involved are: Business Hours, AI Chat, Amazon, Blogroll, Google Docs Embed (Google Docs, Google Sheets, and Google Slides), Recipe, Create with Voice.
In more details:
register_block_type
to be called with the path toblock.json
or its parent directory.jetpack_register_block
is updated accordingly.registerBlockType
requires to be called with the metadata object.registerJetpackBlock
is updated to allow that.render
functions work correctly.init
action, to prevent an exception being thrown.Other information:
Jetpack product discussion
n/a
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Regression Testing
define( 'JETPACK_BLOCKS_VARIATION', 'beta' );
to yourwp-config.php
otherwise.Localization Testing
jetpack build plugins/jetpack
.Blocks info translated to French