From da135fcb0e9172b33c45989562aa11e61ba09fb5 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sun, 5 Jun 2022 14:39:43 -0700 Subject: [PATCH] Layout and language fixes --- assets/src/gutenberg.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/assets/src/gutenberg.js b/assets/src/gutenberg.js index b1a6c60..0e1949f 100644 --- a/assets/src/gutenberg.js +++ b/assets/src/gutenberg.js @@ -16,7 +16,6 @@ const Render = ( { limit, manualPurge, showPurgeButton, updateMeta } ) => ( title={ __( 'WP Revisions Control', 'wp_revisions_control' ) } className={ slug } > - {/* TODO: switch to InputControl when it becomes available. */} <TextControl label={ __( 'Number of revisions to retain:', 'wp_revisions_control' ) } help={ __( 'Leave blank to keep all revisions.', 'wp_revisions_control' ) } @@ -36,17 +35,20 @@ const PurgeModal = ( limit, manualPurge ) => { closeModal(); manualPurge(); }; - - const modalText = sprintf( - /* translators: 1. Number of revisions to keep. */ - _n( - 'This will remove all but the most-recent revision.', - 'This will remove all but the %1$d most-recent revisions.', - parseInt( limit ), - 'wp_revisions_control' - ), - limit - ); + const parsedLimit = parseInt( limit, 10 ); + + const modalText = 0 === parsedLimit + ? __( 'This will remove all revisions.', 'wp_revisions_control' ) + : sprintf( + /* translators: 1. Number of revisions to keep. */ + _n( + 'This will remove all but the most-recent revision.', + 'This will remove all but the %1$d most-recent revisions.', + parsedLimit, + 'wp_revisions_control' + ), + limit + ); return ( <> @@ -64,13 +66,15 @@ const PurgeModal = ( limit, manualPurge ) => { { modalText } </p> - <Button isSecondary onClick={ closeModal }> - { __( 'Cancel', 'wp_revisions_control' ) } - </Button> - <Button isPrimary onClick={ closeModalAndPurge }> { __( 'Purge', 'wp_revisions_control' ) } </Button> + + + + <Button isSecondary onClick={ closeModal }> + { __( 'Cancel', 'wp_revisions_control' ) } + </Button> </Modal> ) } </> -- GitLab