Skip to content

Commit

Permalink
Block Editor: Update strings in blocks 'RenameModal' component (#54887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored and mikachan committed Sep 29, 2023
1 parent 78d3141 commit 3375dbc
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/block-editor/src/hooks/block-rename-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@ function RenameModal( { blockName, originalBlockName, onClose, onSave } ) {
);

const handleSubmit = () => {
// Must be assertive to immediately announce change.
speak(
sprintf(
/* translators: %1$s: type of update (either reset of changed). %2$s: new name/label for the block */
__( 'Block name %1$s to: "%2$s".' ),
nameIsOriginal || nameIsEmpty ? __( 'reset' ) : __( 'changed' ),
editedBlockName
),
'assertive'
);
const message =
nameIsOriginal || nameIsEmpty
? sprintf(
/* translators: %s: new name/label for the block */
__( 'Block name reset to: "%s".' ),
editedBlockName
)
: sprintf(
/* translators: %s: new name/label for the block */
__( 'Block name changed to: "%s".' ),
editedBlockName
);

// Must be assertive to immediately announce change.
speak( message, 'assertive' );
onSave( editedBlockName );

// Immediate close avoids ability to hit save multiple times.
Expand Down

0 comments on commit 3375dbc

Please sign in to comment.