Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better description for embed blocks #6124

Merged
merged 4 commits into from
Apr 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions blocks/library/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ import BlockAlignmentToolbar from '../../block-alignment-toolbar';
// These embeds do not work in sandboxes
const HOSTS_NO_PREVIEWS = [ 'facebook.com' ];

function getEmbedBlockSettings( { title, icon, category = 'embed', transforms, keywords = [] } ) {
function getEmbedBlockSettings( { title, description, icon, category = 'embed', transforms, keywords = [] } ) {
return {
title,

description: __( 'The Embed block allows you to easily add videos, images, tweets, audio, and other content to your post or page.' ),

description: description || __( `Paste URLs from ${ title } to embed the content in this block.` ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of how string extraction works, we cannot do variable string interpolation for translated strings.

This is the same as it is in PHP:

https://codex.wordpress.org/I18n_for_WordPress_Developers#Placeholders

We should use a placeholder here, and wp.i18n.sprintf to do the variable replacement.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aduth my bad missed that part have updated the same here #6354

icon,

category,

keywords,

attributes: {
url: {
type: 'string',
Expand Down Expand Up @@ -259,6 +254,7 @@ export const name = 'core/embed';

export const settings = getEmbedBlockSettings( {
title: __( 'Embed' ),
description: __( 'The Embed block allows you to easily add videos, images, tweets, audio, and other content to your post or page.' ),
icon: 'embed-generic',
transforms: {
from: [
Expand Down