From e1c5e5f0486800373210b09af6fea02a3b8d7f39 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 30 Oct 2020 03:27:15 +0800 Subject: [PATCH] Fix incorrectly pluralised strings (#26565) * Change block mover label i18n * Update remove block i18n --- .../block-editor/src/components/block-mover/index.js | 11 +++++------ .../block-settings-menu/block-settings-dropdown.js | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/block-editor/src/components/block-mover/index.js b/packages/block-editor/src/components/block-mover/index.js index 3f78c9ebfd3b1..fc702ff4a2a48 100644 --- a/packages/block-editor/src/components/block-mover/index.js +++ b/packages/block-editor/src/components/block-mover/index.js @@ -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 @@ -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, @@ -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" diff --git a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js index 0a01e3945519f..b4e6b97e12057 100644 --- a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js +++ b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js @@ -6,7 +6,7 @@ import { castArray, flow, noop } from 'lodash'; /** * WordPress dependencies */ -import { __, _n } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { DropdownMenu, MenuGroup, @@ -74,6 +74,9 @@ export function BlockSettingsDropdown( { [ __experimentalSelectBlock ] ); + const removeBlockLabel = + count === 1 ? __( 'Remove block' ) : __( 'Remove blocks' ); + return ( - { _n( - 'Remove block', - 'Remove blocks', - count - ) } + { removeBlockLabel } ) }