Skip to content

Commit 8b36b2f

Browse files
Replaced dynamic tab label with sprintf, replaced hard coded formats list for withoutInteractiveFormatting.
1 parent 1406cd3 commit 8b36b2f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/block-library/src/tab/tabs-list.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import clsx from 'clsx';
66
/**
77
* WordPress dependencies
88
*/
9-
import { __ } from '@wordpress/i18n';
9+
import { __, sprintf } from '@wordpress/i18n';
1010
import { RichText } from '@wordpress/block-editor';
1111
import { decodeEntities } from '@wordpress/html-entities';
1212

@@ -79,21 +79,23 @@ export default function TabsList( {
7979
<RichText
8080
ref={ labelRef }
8181
tagName="span"
82-
allowedFormats={ [
83-
'core/bold',
84-
'core/italic',
85-
'core/strikethrough',
86-
] }
87-
placeholder={
88-
__( 'Tab' ) + ` ${ currentBlockIndex + 1 }…`
89-
}
82+
withoutInteractiveFormatting
83+
placeholder={ sprintf(
84+
/* translators: %d is the tab index + 1 */
85+
__( 'Tab %d…' ),
86+
currentBlockIndex + 1
87+
) }
9088
value={ decodeEntities( currentLabel ) }
9189
onChange={ onLabelChange }
9290
/>
9391
) : (
9492
<span>
9593
{ decodeEntities( siblingLabel ) ||
96-
__( 'Tab' ) + ` ${ index + 1 }` }
94+
sprintf(
95+
/* translators: %d is the tab index + 1 */
96+
__( 'Tab %d' ),
97+
index + 1
98+
) }
9799
</span>
98100
) }
99101
</button>

0 commit comments

Comments
 (0)