Skip to content

Commit

Permalink
Do not assume that singular form in _n() is used just for single item (
Browse files Browse the repository at this point in the history
…#9711)

* Split _n() strings to use separate strigs for cases with just one item.

* i18n: Format long lines across multiple
  • Loading branch information
dimadin authored and aduth committed Sep 10, 2018
1 parent 8b1926d commit c967c21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion edit-post/components/sidebar/settings-header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const SettingsHeader = ( { count, openDocumentSettings, openBlockSettings, sideb
className={ `edit-post-sidebar__panel-tab ${ sidebarName === 'edit-post/block' ? 'is-active' : '' }` }
aria-label={ __( 'Block settings' ) }
>
{ sprintf( _n( 'Block', '%d Blocks', count ), count ) }
{ (
1 === count ?
__( 'Block' ) :
sprintf( _n( '%d Block', '%d Blocks', count ), count )
) }
</button>
</SidebarHeader>
);
Expand Down
13 changes: 12 additions & 1 deletion packages/editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@ export class BlockSwitcher extends Component {
onToggle();
}
};
const label = sprintf( _n( 'Change block type', 'Change type of %d blocks', blocks.length ), blocks.length );
const label = (
1 === blocks.length ?
__( 'Change block type' ) :
sprintf(
_n(
'Change type of %d block',
'Change type of %d blocks',
blocks.length
),
blocks.length
)
);

return (
<Toolbar>
Expand Down

0 comments on commit c967c21

Please sign in to comment.