From a6a9a8f0b6a38253ae786a56a9a21686e9545b47 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 19 Nov 2018 13:01:26 +0100 Subject: [PATCH] Improve i18n negligence in MultiSelectionInspector (#12054) Addresses an issue introduced in #12050. --- .../components/multi-selection-inspector/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/multi-selection-inspector/index.js b/packages/editor/src/components/multi-selection-inspector/index.js index 3b569f86495df..5378c5fe6f539 100644 --- a/packages/editor/src/components/multi-selection-inspector/index.js +++ b/packages/editor/src/components/multi-selection-inspector/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { sprintf, __ } from '@wordpress/i18n'; +import { sprintf, _n } from '@wordpress/i18n'; import { withSelect } from '@wordpress/data'; import { serialize } from '@wordpress/blocks'; import { count as wordCount } from '@wordpress/wordcount'; @@ -16,6 +16,8 @@ import { import BlockIcon from '../block-icon'; function MultiSelectionInspector( { blocks } ) { + const words = wordCount( serialize( blocks ), 'words' ); + return (
- { sprintf( __( '%d blocks' ), blocks.length ) } + { + /* translators: %d: number of blocks */ + sprintf( _n( '%d block', '%d blocks', blocks.length ), blocks.length ) + }
- { sprintf( __( '%d words.' ), wordCount( serialize( blocks ), 'words' ) ) } + { + /* translators: %d: number of words */ + sprintf( _n( '%d word', '%d words', words ), words ) + }