Skip to content

Commit

Permalink
Patterns: Use "detached" copy consistently (WordPress#51993)
Browse files Browse the repository at this point in the history
  • Loading branch information
richtabor authored and sethrubenstein committed Jul 13, 2023
1 parent ab52b7c commit 3e2996f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,12 @@ const BlockActionsMenu = ( {
id: 'convertToRegularBlocksOption',
label:
innerBlockCount > 1
? __( 'Convert to regular blocks' )
: __( 'Convert to regular block' ),
? __( 'Detach patterns' )
: __( 'Detach pattern' ),
value: 'convertToRegularBlocksOption',
onSelect: () => {
const successNotice =
innerBlockCount > 1
? /* translators: %s: name of the reusable block */
__( '%s converted to regular blocks' )
: /* translators: %s: name of the reusable block */
__( '%s converted to regular block' );
/* translators: %s: name of the synced block */
const successNotice = __( '%s detached' );
createSuccessNotice(
sprintf(
successNotice,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export default function ReusableBlockEdit( { attributes: { ref }, clientId } ) {
onClick={ () => convertBlockToStatic( clientId ) }
label={
innerBlockCount > 1
? __( 'Convert to regular blocks' )
: __( 'Convert to regular block' )
? __( 'Detach patterns' )
: __( 'Detach pattern' )
}
icon={ ungroup }
showTooltip
Expand Down
16 changes: 6 additions & 10 deletions packages/block-library/src/block/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@ export default function ReusableBlockEdit( {
}

const onConvertToRegularBlocks = useCallback( () => {
const successNotice =
innerBlockCount > 1
? /* translators: %s: name of the reusable block */
__( '%s converted to regular blocks' )
: /* translators: %s: name of the reusable block */
__( '%s converted to regular block' );
/* translators: %s: name of the synced block */
const successNotice = __( '%s detached' );
createSuccessNotice( sprintf( successNotice, title ) );

clearSelectedBlock();
Expand Down Expand Up @@ -182,17 +178,17 @@ export default function ReusableBlockEdit( {
<Text style={ [ infoTextStyle, infoDescriptionStyle ] }>
{ innerBlockCount > 1
? __(
'Alternatively, you can detach and edit these blocks separately by tapping “Convert to regular blocks”.'
'Alternatively, you can detach and edit these blocks separately by tapping “Detach patterns”.'
)
: __(
'Alternatively, you can detach and edit this block separately by tapping “Convert to regular block”.'
'Alternatively, you can detach and edit this block separately by tapping “Detach pattern”.'
) }
</Text>
<TextControl
label={
innerBlockCount > 1
? __( 'Convert to regular blocks' )
: __( 'Convert to regular block' )
? __( 'Detach patterns' )
: __( 'Detach pattern' )
}
separatorType="topFullWidth"
onPress={ onConvertToRegularBlocks }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe( 'Reusable blocks', () => {
await insertReusableBlock( 'Surprised greeting block' );

// Convert block to a regular block.
await clickBlockToolbarButton( 'Convert to regular block' );
await clickBlockToolbarButton( 'Detach pattern' );

// Check that we have a paragraph block on the page.
const paragraphBlock = await canvas().$(
Expand Down Expand Up @@ -221,7 +221,7 @@ describe( 'Reusable blocks', () => {
await insertReusableBlock( 'Multi-selection reusable block' );

// Convert block to a regular block.
await clickBlockToolbarButton( 'Convert to regular blocks' );
await clickBlockToolbarButton( 'Detach patterns' );

// Check that we have two paragraph blocks on the page.
expect( await getEditedPostContent() ).toMatchSnapshot();
Expand Down Expand Up @@ -353,7 +353,7 @@ describe( 'Reusable blocks', () => {

// Convert back to regular blocks.
await clickBlockToolbarButton( 'Select Pattern' );
await clickBlockToolbarButton( 'Convert to regular block' );
await clickBlockToolbarButton( 'Detach pattern' );
await page.waitForXPath( selector, {
hidden: true,
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function ReusableBlocksManageButton( { clientId } ) {
{ canRemove && (
<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>
{ innerBlockCount > 1
? __( 'Convert to regular blocks' )
: __( 'Convert to regular block' ) }
? __( 'Detach patterns' )
: __( 'Detach pattern' ) }
</MenuItem>
) }
</BlockSettingsMenuControls>
Expand Down

0 comments on commit 3e2996f

Please sign in to comment.