Skip to content

Commit

Permalink
DataViews: Fix text in action for setting site home page (#67787)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: mikachan <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent d2d0762 commit 849ee8d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions packages/editor/src/components/post-actions/set-as-homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ const SetAsHomepageModal = ( { items, closeModal } ) => {
};
}
);
const currentHomePageTitle = currentHomePage
? getItemTitle( currentHomePage )
: '';

const { saveEditedEntityRecord, saveEntityRecord } =
useDispatch( coreStore );
Expand Down Expand Up @@ -89,23 +86,25 @@ const SetAsHomepageModal = ( { items, closeModal } ) => {
}
}

const modalWarning =
'posts' === showOnFront
? __(
'This will replace the current homepage which is set to display latest posts.'
)
: sprintf(
// translators: %s: title of the current home page.
__( 'This will replace the current homepage: "%s"' ),
currentHomePageTitle
);
let modalWarning = '';
if ( 'posts' === showOnFront ) {
modalWarning = __(
'This will replace the current homepage which is set to display latest posts.'
);
} else if ( currentHomePage ) {
modalWarning = sprintf(
// translators: %s: title of the current home page.
__( 'This will replace the current homepage: "%s"' ),
getItemTitle( currentHomePage )
);
}

const modalText = sprintf(
// translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message.
__( 'Set "%1$s" as the site homepage? %2$s' ),
pageTitle,
modalWarning
);
).trim();

// translators: Button label to confirm setting the specified page as the homepage.
const modalButtonLabel = __( 'Set homepage' );
Expand Down

0 comments on commit 849ee8d

Please sign in to comment.