diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index ca673e3867bdaf..3c185cfe0661fc 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -6,7 +6,7 @@ import { addQueryArgs } from '@wordpress/url'; import { useDispatch } from '@wordpress/data'; import { decodeEntities } from '@wordpress/html-entities'; import { store as coreStore } from '@wordpress/core-data'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, sprintf, _n } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import { useMemo } from '@wordpress/element'; import { privateApis as routerPrivateApis } from '@wordpress/router'; @@ -28,23 +28,34 @@ export const trashPostAction = { id: 'move-to-trash', label: __( 'Move to Trash' ), isPrimary: true, + isBulk: true, icon: trash, isEligible( { status } ) { return status !== 'trash'; }, hideModalHeader: true, - RenderModal: ( { item: post, closeModal } ) => { + RenderModal: ( { items: posts, closeModal } ) => { const { createSuccessNotice, createErrorNotice } = useDispatch( noticesStore ); const { deleteEntityRecord } = useDispatch( coreStore ); return ( - { sprintf( - // translators: %s: The page's title. - __( 'Are you sure you want to delete "%s"?' ), - decodeEntities( post.title.rendered ) - ) } + { posts.length > 1 + ? sprintf( + // translators: %s: The number of posts (always plural). + __( + 'Are you sure you want to delete %s posts?' + ), + decodeEntities( posts.length ) + ) + : sprintf( + // translators: %s: The page's title. + __( 'Are you sure you want to delete "%s"?' ), + decodeEntities( + posts && posts[ 0 ]?.title?.rendered + ) + ) }