From 12dead5c524b5d22e59463fdce288d0b2e950601 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 30 Jul 2024 15:59:18 +0200 Subject: [PATCH 1/3] DataViews Actions: Update the copy of some the strings --- .../actions/permanently-delete-post.tsx | 10 ++++----- .../src/dataviews/actions/trash-post.tsx | 22 +++++++++---------- .../editor/various/change-detection.spec.js | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/editor/src/dataviews/actions/permanently-delete-post.tsx b/packages/editor/src/dataviews/actions/permanently-delete-post.tsx index 42efb8a32850f3..2124fdc0ffa4ce 100644 --- a/packages/editor/src/dataviews/actions/permanently-delete-post.tsx +++ b/packages/editor/src/dataviews/actions/permanently-delete-post.tsx @@ -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', @@ -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 @@ -86,13 +86,13 @@ 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 ] ); @@ -100,7 +100,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = { 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( ',' ) ); diff --git a/packages/editor/src/dataviews/actions/trash-post.tsx b/packages/editor/src/dataviews/actions/trash-post.tsx index c6a265eba81f5a..c10509cd269df0 100644 --- a/packages/editor/src/dataviews/actions/trash-post.tsx +++ b/packages/editor/src/dataviews/actions/trash-post.tsx @@ -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 ) { @@ -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 to the trash "%s"?' ), 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 to the trash %d item?', + 'Are you sure you want to move to the trash %d items?', items.length ), items.length @@ -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 @@ -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 to the trash the item.' ); } // If we were trying to delete multiple items. @@ -151,13 +151,13 @@ const trashPost: Action< PostWithPermissions > = { } if ( errorMessages.size === 0 ) { errorMessage = __( - 'An error occurred while moving to trash the items.' + 'An error occurred while moving to the trash the items.' ); } 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 to the trash the item: %s' ), [ ...errorMessages ][ 0 ] ); @@ -165,7 +165,7 @@ const trashPost: Action< PostWithPermissions > = { 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 to the trash the items: %s' ), [ ...errorMessages ].join( ',' ) ); diff --git a/test/e2e/specs/editor/various/change-detection.spec.js b/test/e2e/specs/editor/various/change-detection.spec.js index 4ac262f4c1348d..30b2287a8d9439 100644 --- a/test/e2e/specs/editor/various/change-detection.spec.js +++ b/test/e2e/specs/editor/various/change-detection.spec.js @@ -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' ) From c94afc7430b49bbd4f8f1f0aff34e020798288cb Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 30 Jul 2024 16:11:14 +0200 Subject: [PATCH 2/3] Apply review suggestion Co-authored-by: Pascal Birchler --- packages/editor/src/dataviews/actions/trash-post.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/dataviews/actions/trash-post.tsx b/packages/editor/src/dataviews/actions/trash-post.tsx index c10509cd269df0..f6d52ad147e797 100644 --- a/packages/editor/src/dataviews/actions/trash-post.tsx +++ b/packages/editor/src/dataviews/actions/trash-post.tsx @@ -58,8 +58,8 @@ const trashPost: Action< PostWithPermissions > = { : sprintf( // translators: %d: The number of items (2 or more). _n( - 'Are you sure you want to move to the trash %d item?', - 'Are you sure you want to move to the 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 From 7873765cb4b2808060102ea23dd8dc00620c338c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 30 Jul 2024 16:11:56 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Pascal Birchler --- packages/editor/src/dataviews/actions/trash-post.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/dataviews/actions/trash-post.tsx b/packages/editor/src/dataviews/actions/trash-post.tsx index f6d52ad147e797..0f9e824293ede9 100644 --- a/packages/editor/src/dataviews/actions/trash-post.tsx +++ b/packages/editor/src/dataviews/actions/trash-post.tsx @@ -51,7 +51,7 @@ const trashPost: Action< PostWithPermissions > = { ? sprintf( // translators: %s: The item's title. __( - 'Are you sure you want to move to the trash "%s"?' + 'Are you sure you want to move "%s" to the trash?' ), getItemTitle( items[ 0 ] ) ) @@ -130,7 +130,7 @@ const trashPost: Action< PostWithPermissions > = { typedError.reason.message; } else { errorMessage = __( - 'An error occurred while moving to the trash the item.' + 'An error occurred while moving the item to the trash.' ); } // If we were trying to delete multiple items. @@ -151,13 +151,13 @@ const trashPost: Action< PostWithPermissions > = { } if ( errorMessages.size === 0 ) { errorMessage = __( - 'An error occurred while moving to the 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 the trash the item: %s' + 'An error occurred while moving the item to the trash: %s' ), [ ...errorMessages ][ 0 ] ); @@ -165,7 +165,7 @@ const trashPost: Action< PostWithPermissions > = { errorMessage = sprintf( /* translators: %s: a list of comma separated error messages */ __( - 'Some errors occurred while moving to the trash the items: %s' + 'Some errors occurred while moving the items to the trash: %s' ), [ ...errorMessages ].join( ',' ) );