From 350d96e07bfe27ceee940b55575a7d838d276466 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 7 Sep 2023 10:00:47 +0100 Subject: [PATCH] Make edit wording contional on whether creating or editing the link --- .../src/components/link-control/index.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index c2593ab135b0d5..6c82be34ba39fd 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -13,7 +13,7 @@ import { TextControl, VisuallyHidden, } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { useRef, useState, useEffect } from '@wordpress/element'; import { focus } from '@wordpress/dom'; import { ENTER } from '@wordpress/keycodes'; @@ -355,6 +355,7 @@ function LinkControl( { const showTextControl = hasLinkValue && hasTextControl; const isEditing = ( isEditingLink || ! value ) && ! isCreatingPage; + const isCreating = isEditingLink && ! value && ! isCreatingPage; const isDisabled = ! valueHasChanges || currentInputIsEmpty; const showSettings = !! settings?.length && isEditingLink && hasLinkValue; @@ -386,10 +387,20 @@ function LinkControl( { { isEditing && ( <> -

{ __( 'Edit Link' ) }

+

+ { sprintf( + // translators: %s: action name for the link mode (edit or create). + __( '%s Link' ), + isCreating ? __( 'Create' ) : __( 'Edit' ) + ) } +

- { __( 'Editing the link.' ) } + { sprintf( + // translators: %s: action name for the link action (edit or create). + __( '%s the link' ), + isCreating ? __( 'Creating' ) : __( 'Editing' ) + ) }