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

try using translation function with registerBlockType #2332

Merged
merged 1 commit into from
Mar 18, 2022
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: 9 additions & 1 deletion src/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { supportsCollections } from './block-helpers';
import { isBlobURL } from '@wordpress/blob';
import { registerBlockType } from '@wordpress/blocks';
import TokenList from '@wordpress/token-list';
import { __, sprintf } from '@wordpress/i18n';

// Set dim ratio.
export function overlayToClass( ratio ) {
Expand Down Expand Up @@ -131,12 +132,19 @@ export const registerBlock = ( block ) => {
}

registerBlockType( name, {
category,
...settings,
category,
icon,

// V2 Block API Upgrades
...v2Settings,

// Title prop must be translated to appear in WP.org details page.
title: sprintf(
/* translators: %s: placeholder for a block title*/
__( '%s block', 'coblocks' ),
settings.title
),
} );
};

Expand Down