Skip to content

Commit

Permalink
Improve i18n negligence in MultiSelectionInspector (#12054)
Browse files Browse the repository at this point in the history
Addresses an issue introduced in #12050.
  • Loading branch information
swissspidy authored and gziolo committed Nov 19, 2018
1 parent eee99f1 commit a6a9a8f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/editor/src/components/multi-selection-inspector/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -16,17 +16,25 @@ import {
import BlockIcon from '../block-icon';

function MultiSelectionInspector( { blocks } ) {
const words = wordCount( serialize( blocks ), 'words' );

return (
<div className="editor-multi-selection-inspector__card">
<BlockIcon icon={
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><Path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z" /></SVG>
} showColors />
<div className="editor-multi-selection-inspector__card-content">
<div className="editor-multi-selection-inspector__card-title">
{ sprintf( __( '%d blocks' ), blocks.length ) }
{
/* translators: %d: number of blocks */
sprintf( _n( '%d block', '%d blocks', blocks.length ), blocks.length )
}
</div>
<div className="editor-multi-selection-inspector__card-description">
{ sprintf( __( '%d words.' ), wordCount( serialize( blocks ), 'words' ) ) }
{
/* translators: %d: number of words */
sprintf( _n( '%d word', '%d words', words ), words )
}
</div>
</div>
</div>
Expand Down

0 comments on commit a6a9a8f

Please sign in to comment.