From 42a7d53345efb3bd113b5c39b19b708d426dd8d6 Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Thu, 17 Mar 2022 13:04:51 -0700 Subject: [PATCH] try using translation function with registerBlockType --- src/utils/helper.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/helper.js b/src/utils/helper.js index 1392be7e068..3a2088cc669 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -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 ) { @@ -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 + ), } ); };