Skip to content

Commit

Permalink
Fix incorrectly pluralised strings (#26565)
Browse files Browse the repository at this point in the history
* Change block mover label i18n

* Update remove block i18n
  • Loading branch information
talldan authored Oct 29, 2020
1 parent 5d7ebd1 commit fbc3a8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions packages/block-editor/src/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';
import { getBlockType } from '@wordpress/blocks';
import { useState } from '@wordpress/element';
import { withSelect } from '@wordpress/data';
import { _n } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -40,6 +40,9 @@ function BlockMover( {
return null;
}

const dragHandleLabel =
clientIds.length === 1 ? __( 'Drag block' ) : __( 'Drag blocks' );

// We emulate a disabled state because forcefully applying the `disabled`
// attribute on the buttons while it has focus causes the screen to change
// to an unfocused state (body as active element) without firing blur on,
Expand All @@ -61,11 +64,7 @@ function BlockMover( {
icon={ dragHandle }
className="block-editor-block-mover__drag-handle"
aria-hidden="true"
label={ _n(
'Drag block',
'Drag blocks',
clientIds.length
) }
label={ dragHandleLabel }
// Should not be able to tab to drag handle as this
// button can only be used with a pointer device.
tabIndex="-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { castArray, flow, noop } from 'lodash';
/**
* WordPress dependencies
*/
import { __, _n } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import {
DropdownMenu,
MenuGroup,
Expand Down Expand Up @@ -74,6 +74,9 @@ export function BlockSettingsDropdown( {
[ __experimentalSelectBlock ]
);

const removeBlockLabel =
count === 1 ? __( 'Remove block' ) : __( 'Remove blocks' );

return (
<BlockActions
clientIds={ clientIds }
Expand Down Expand Up @@ -185,11 +188,7 @@ export function BlockSettingsDropdown( {
) }
shortcut={ shortcuts.remove }
>
{ _n(
'Remove block',
'Remove blocks',
count
) }
{ removeBlockLabel }
</MenuItem>
) }
</MenuGroup>
Expand Down

0 comments on commit fbc3a8a

Please sign in to comment.