Skip to content
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

DataViews Actions: Update the copy of some the strings #64099

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
getItemTitle( posts[ 0 ] )
);
} else {
successMessage = __( 'The posts were permanently deleted.' );
successMessage = __( 'The items were permanently deleted.' );
}
createSuccessNotice( successMessage, {
type: 'snackbar',
Expand All @@ -67,7 +67,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
errorMessage = typedError.reason.message;
} else {
errorMessage = __(
'An error occurred while permanently deleting the post.'
'An error occurred while permanently deleting the item.'
);
}
// If we were trying to permanently delete multiple posts
Expand All @@ -86,21 +86,21 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
}
if ( errorMessages.size === 0 ) {
errorMessage = __(
'An error occurred while permanently deleting the posts.'
'An error occurred while permanently deleting the items.'
);
} else if ( errorMessages.size === 1 ) {
errorMessage = sprintf(
/* translators: %s: an error message */
__(
'An error occurred while permanently deleting the posts: %s'
'An error occurred while permanently deleting the items: %s'
),
[ ...errorMessages ][ 0 ]
);
} else {
errorMessage = sprintf(
/* translators: %s: a list of comma separated error messages */
__(
'Some errors occurred while permanently deleting the posts: %s'
'Some errors occurred while permanently deleting the items: %s'
),
[ ...errorMessages ].join( ',' )
);
Expand Down
22 changes: 11 additions & 11 deletions packages/editor/src/dataviews/actions/trash-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { CoreDataError, PostWithPermissions } from '../types';

const trashPost: Action< PostWithPermissions > = {
id: 'move-to-trash',
label: __( 'Move to Trash' ),
label: __( 'Move to trash' ),
isPrimary: true,
icon: trash,
isEligible( item ) {
Expand Down Expand Up @@ -51,15 +51,15 @@ const trashPost: Action< PostWithPermissions > = {
? sprintf(
// translators: %s: The item's title.
__(
'Are you sure you want to move to trash "%s"?'
'Are you sure you want to move "%s" to the trash?'
),
getItemTitle( items[ 0 ] )
)
: sprintf(
// translators: %d: The number of items (2 or more).
_n(
'Are you sure you want to move to trash %d item?',
'Are you sure you want to move to trash %d items?',
'Are you sure you want to move %d item to the trash ?',
'Are you sure you want to move %d items to the trash ?',
items.length
),
items.length
Expand Down Expand Up @@ -99,15 +99,15 @@ const trashPost: Action< PostWithPermissions > = {
if ( promiseResult.length === 1 ) {
successMessage = sprintf(
/* translators: The item's title. */
__( '"%s" moved to trash.' ),
__( '"%s" moved to the trash.' ),
getItemTitle( items[ 0 ] )
);
} else {
successMessage = sprintf(
/* translators: The number of items. */
_n(
'%s item moved to trash.',
'%s items moved to trash.',
'%s item moved to the trash.',
'%s items moved to the trash.',
items.length
),
items.length
Expand All @@ -130,7 +130,7 @@ const trashPost: Action< PostWithPermissions > = {
typedError.reason.message;
} else {
errorMessage = __(
'An error occurred while moving to trash the item.'
'An error occurred while moving the item to the trash.'
);
}
// If we were trying to delete multiple items.
Expand All @@ -151,21 +151,21 @@ const trashPost: Action< PostWithPermissions > = {
}
if ( errorMessages.size === 0 ) {
errorMessage = __(
'An error occurred while moving to trash the items.'
'An error occurred while moving the items to the trash.'
);
} else if ( errorMessages.size === 1 ) {
errorMessage = sprintf(
/* translators: %s: an error message */
__(
'An error occurred while moving to trash the item: %s'
'An error occurred while moving the item to the trash: %s'
),
[ ...errorMessages ][ 0 ]
);
} else {
errorMessage = sprintf(
/* translators: %s: a list of comma separated error messages */
__(
'Some errors occurred while moving to trash the items: %s'
'Some errors occurred while moving the items to the trash: %s'
),
[ ...errorMessages ].join( ',' )
);
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/change-detection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ test.describe( 'Change detection', () => {
.click();
await page
.getByRole( 'menu' )
.getByRole( 'menuitem', { name: 'Move to Trash' } )
.getByRole( 'menuitem', { name: 'Move to trash' } )
.click();
await page
.getByRole( 'dialog' )
Expand Down
Loading