Skip to content

Commit

Permalink
Simplify template reset language (#60256)
Browse files Browse the repository at this point in the history
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: SaxonF <[email protected]>
Co-authored-by: annezazu <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
6 people authored Apr 3, 2024
1 parent d6a2e5d commit 99597b1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const deleteAction = {

export const resetAction = {
id: 'reset-action',
label: __( 'Clear customizations' ),
label: __( 'Reset' ),
isEligible: ( item ) => {
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
Expand All @@ -339,9 +339,7 @@ export const resetAction = {
return (
<VStack spacing="5">
<Text>
{ __(
'Are you sure you want to clear these customizations?'
) }
{ __( 'Reset to default and clear all customizations?' ) }
</Text>
<HStack justify="right">
<Button variant="tertiary" onClick={ closeModal }>
Expand All @@ -351,7 +349,7 @@ export const resetAction = {
variant="primary"
onClick={ () => removeTemplate( item ) }
>
{ __( 'Clear' ) }
{ __( 'Reset' ) }
</Button>
</HStack>
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { TEMPLATE_POST_TYPE } from '../../utils/constants';

export const resetTemplateAction = {
id: 'reset-template',
label: __( 'Clear customizations' ),
label: __( 'Reset' ),
isEligible: isTemplateRevertable,
supportsBulk: true,
hideModalHeader: true,
Expand All @@ -52,12 +52,12 @@ export const resetTemplateAction = {
items.length > 1
? sprintf(
/* translators: The number of items. */
__( '%s items reverted.' ),
__( '%s items reset.' ),
items.length
)
: sprintf(
/* translators: The template/part's name. */
__( '"%s" reverted.' ),
__( '"%s" reset.' ),
decodeEntities( items[ 0 ].title.rendered )
),
{
Expand Down Expand Up @@ -97,9 +97,7 @@ export const resetTemplateAction = {
return (
<VStack spacing="5">
<Text>
{ __(
'Are you sure you want to clear these customizations?'
) }
{ __( 'Reset to default and clear all customizations?' ) }
</Text>
<HStack justify="right">
<Button variant="tertiary" onClick={ closeModal }>
Expand All @@ -113,7 +111,7 @@ export const resetTemplateAction = {
closeModal();
} }
>
{ __( 'Clear' ) }
{ __( 'Reset' ) }
</Button>
</HStack>
</VStack>
Expand Down
13 changes: 5 additions & 8 deletions packages/edit-site/src/components/template-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function ResetMenuItem( { template, onClose } ) {
createSuccessNotice(
sprintf(
/* translators: The template/part's name. */
__( '"%s" reverted.' ),
__( '"%s" reset.' ),
decodeEntities( template.title.rendered )
),
{
Expand All @@ -123,11 +123,8 @@ function ResetMenuItem( { template, onClose } ) {
}
return (
<>
<MenuItem
info={ __( 'Use the template as supplied by the theme.' ) }
onClick={ () => setIsModalOpen( true ) }
>
{ __( 'Clear customizations' ) }
<MenuItem onClick={ () => setIsModalOpen( true ) }>
{ __( 'Reset' ) }
</MenuItem>
<ConfirmDialog
isOpen={ isModalOpen }
Expand All @@ -136,9 +133,9 @@ function ResetMenuItem( { template, onClose } ) {
onClose();
} }
onCancel={ () => setIsModalOpen( false ) }
confirmButtonText={ __( 'Clear' ) }
confirmButtonText={ __( 'Reset' ) }
>
{ __( 'Are you sure you want to clear these customizations?' ) }
{ __( 'Rese to default and clear all customizations?' ) }
</ConfirmDialog>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export const revertTemplate =

registry
.dispatch( noticesStore )
.createSuccessNotice( __( 'Template reverted.' ), {
.createSuccessNotice( __( 'Template reset.' ), {
type: 'snackbar',
id: noticeId,
actions: [
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/site-editor/template-revert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ class TemplateRevertUtils {
await this.page.click(
'role=region[name="Editor settings"i] >> role=button[name="Actions"i]'
);
await this.page.click( 'role=menuitem[name=/Clear customizations/i]' );
await this.page.getByRole( 'button', { name: 'Clear' } ).click();
await this.page.click( 'role=menuitem[name=/Reset/i]' );
await this.page.getByRole( 'button', { name: 'Reset' } ).click();
await this.page.waitForSelector(
'role=button[name="Dismiss this notice"i] >> text=/ reverted./'
'role=button[name="Dismiss this notice"i] >> text=/ reset./'
);
}

Expand Down

0 comments on commit 99597b1

Please sign in to comment.