Skip to content

Commit

Permalink
Post comments form block show warning wrt to post/page (#38011)
Browse files Browse the repository at this point in the history
Earlier, we were showing a single hardcorded message irrespective of
post type. Warning message used to write post even in case of WP page.
It would be better if we show post in case of post and page in case of
acutal page. Merging this change will also help user in terms of reading
and understanding warning message.
  • Loading branch information
amustaque97 authored Feb 28, 2022
1 parent 4094ad7 commit f392267
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/block-library/src/post-comments-form/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
useBlockProps,
} from '@wordpress/block-editor';
import { useEntityProp } from '@wordpress/core-data';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

export default function PostCommentsFormEdit( {
attributes,
Expand Down Expand Up @@ -55,8 +55,12 @@ export default function PostCommentsFormEdit( {

{ 'open' !== commentStatus && (
<Warning>
{ __(
'Post Comments Form block: comments to this post are not allowed.'
{ sprintf(
/* translators: 1: Post type (i.e. "post", "page") */
__(
'Post Comments Form block: comments to this %s are not allowed.'
),
postType
) }
</Warning>
) }
Expand Down

0 comments on commit f392267

Please sign in to comment.