Fix `Single product` translations on edit mode (#50599)

* Format json

* Get title and description from the registered block

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Add empty array dep

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Alba Rincón 2024-08-14 10:43:15 +02:00 committed by GitHub
parent 5c980cc629
commit d04666e35c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View File

@ -17,12 +17,12 @@
"productId": {
"type": "number"
}
},
"example": {
},
"example": {
"attributes": {
"isPreview": true
"isPreview": true
}
},
},
"usesContext": [ "postId", "postType", "queryId" ],
"textdomain": "woocommerce",
"apiVersion": 2,

View File

@ -53,6 +53,11 @@ const Editor = ( {
const [ isEditing, setIsEditing ] = useState( ! productId );
const blockProps = useBlockProps();
const block = useSelect(
( select ) => select( 'core/blocks' ).getBlockType( metadata.name ),
[]
);
const productPreview = useSelect( ( select ) => {
if ( ! isPreview ) {
return null;
@ -102,10 +107,10 @@ const Editor = ( {
{ isEditing ? (
<Placeholder
icon={ BLOCK_ICON }
label={ metadata.title }
label={ block.title }
className="wc-block-editor-single-product"
>
{ metadata.description }
{ block.description }
<div className="wc-block-editor-single-product__selection">
<SharedProductControl
attributes={ attributes }

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Single product block - Fix translation for title and description in edit mode.