Skip to content

Commit

Permalink
Block Directory: Use the block's title for alt text on block director…
Browse files Browse the repository at this point in the history
…y plugin items. (#19263)

Merged pull request #19263 into master.

* Block Directory: Use the block's title to construct an alt text for the block's icon when they are using an image file.

Fixes:
https://github.com/WordPress/gutenberg/pull/16524/files#r324268820

* Add an accompanying translator comment to explain the placeholder.
  • Loading branch information
StevenDufresne authored and MarcoZehe committed Dec 23, 2019
1 parent 061dfb0 commit 0553213
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -15,7 +15,8 @@ function DownloadableBlockHeader( { icon, title, rating, ratingCount, onClick }
<div className="block-directory-downloadable-block-header__row">
{
icon.match( /\.(jpeg|jpg|gif|png)$/ ) !== null ?
<img src={ icon } alt="block icon" /> :
// translators: %s: Name of the plugin e.g: "Akismet".
<img src={ icon } alt={ sprintf( __( '%s block icon' ), title ) } /> :
<span >
<BlockIcon icon={ icon } showColors />
</span>
Expand Down

0 comments on commit 0553213

Please sign in to comment.