Skip to content

Commit

Permalink
Update message logic to handle translations
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Feb 28, 2024
1 parent 142107e commit 8741ca9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
12 changes: 7 additions & 5 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,13 @@ export function ImageEdit( {
!! metadata?.bindings?.url &&
( ! blockBindingsSource ||
blockBindingsSource?.lockAttributesEditing ),
lockUrlControlsMessage: sprintf(
/* translators: %s: Label of the bindings source if exists */
__( 'Connected to %s' ),
blockBindingsSource?.label || __( 'dynamic data' )
),
lockUrlControlsMessage: blockBindingsSource?.label
? sprintf(
/* translators: %s: Label of the bindings source. */
__( 'Connected to %s' ),
blockBindingsSource.label
)
: __( 'Connected to dynamic data' ),
};
},
[ isSingleSelected ]
Expand Down
24 changes: 14 additions & 10 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,24 @@ export default function Image( {
!! altBinding &&
( ! altBindingSource ||
altBindingSource?.lockAttributesEditing ),
lockAltControlsMessage: sprintf(
/* translators: %s: Label of the bindings source if exists */
__( 'Connected to %s' ),
altBindingSource?.label || __( 'dynamic data' )
),
lockAltControlsMessage: altBindingSource?.label
? sprintf(
/* translators: %s: Label of the bindings source. */
__( 'Connected to %s' ),
altBindingSource.label
)
: __( 'Connected to dynamic data' ),
lockTitleControls:
!! titleBinding &&
( ! titleBindingSource ||
titleBindingSource?.lockAttributesEditing ),
lockTitleControlsMessage: sprintf(
/* translators: %s: Label of the bindings source if exists */
__( 'Connected to %s' ),
titleBindingSource?.label || __( 'dynamic data' )
),
lockTitleControlsMessage: titleBindingSource?.label
? sprintf(
/* translators: %s: Label of the bindings source. */
__( 'Connected to %s' ),
titleBindingSource.label
)
: __( 'Connected to dynamic data' ),
};
},
[ clientId, isSingleSelected, metadata?.bindings ]
Expand Down

0 comments on commit 8741ca9

Please sign in to comment.