-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Show proper message on trash of an entity #25563
Conversation
Size Change: +33 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as expected, thanks @ntsekouras!
Seeing the discussion happening on #19144, I agree that perhaps the best solution is to have the notice on the posts page announce the trash action, but I think this is a welcoming change while that gets sorted out.
// we add the message manually. | ||
// Reference: https://developer.wordpress.org/reference/functions/get_post_type_labels/ | ||
if ( isTrashed ) { | ||
noticeMessage = `${ postType.labels.singular_name } trashed.`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trashed
part of this string is not translatable.
Also, we should avoid translatable strings made by concatenating a variable part with other text as this is not well translatbale in some languages. This should use a new post label to be introduced in core. Thus, it requires a patch for core. Note that in WordPress 5.0 new post labels were introduced for use in Gutenberg so this wouldn't be unprecedented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened a ticket for this: https://core.trac.wordpress.org/ticket/51387
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntsekouras a core ticket should not be a blocker for this.
Compat shims can be added to Gutenberg.
And even when that's not possible, we should not push strings that are not translatable.
I think this has been merged a bit too quickly 🙂 |
This reverts commit f9965bb.
@afercia you're right about the translation. I opened a ticket in core as commented above(https://core.trac.wordpress.org/ticket/51387) and created a revert PR here: #25604 |
Description
Fixes: #19144
When moving a post to
trash
from the Document settings pane in Gutenberg, shows a wrong message (reverted to draft
).This is because we don't handle the
trash
case.Since there is not a label for a post_type
trash
action, I have added that manually with a message:{Singular name of entity's labels} trashed
.The singular name is dynamic per post type.
Reference: https://developer.wordpress.org/reference/functions/get_post_type_labels/
Checklist: