Skip to content

Commit

Permalink
I18N: Move code out of translatable strings in a few error messages.
Browse files Browse the repository at this point in the history
Follow-up to [54272], [56101].

Props rabmalin, Presskopp.
Fixes #59563.

git-svn-id: https://develop.svn.wordpress.org/trunk@57135 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 25, 2023
1 parent 5ff4794 commit cd5cf79
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/wp-includes/class-wp-duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,11 @@ private static function get_filter_svg( $filter_id, $colors ) {

if ( null === $color ) {
$error_message = sprintf(
/* translators: %s: duotone colors */
__( '"%s" in theme.json settings.color.duotone is not a hex or rgb string.' ),
$color_str
/* translators: 1: Duotone colors, 2: theme.json, 3: settings.color.duotone */
__( '"%1$s" in %2$s %3$s is not a hex or rgb string.' ),
$color_str,
'theme.json',
'settings.color.duotone'
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
} else {
Expand Down Expand Up @@ -900,9 +902,10 @@ private static function enqueue_global_styles_preset( $filter_id, $duotone_selec
$global_styles_presets = self::get_all_global_styles_presets();
if ( ! array_key_exists( $filter_id, $global_styles_presets ) ) {
$error_message = sprintf(
/* translators: %s: duotone filter ID */
__( 'The duotone id "%s" is not registered in theme.json settings' ),
$filter_id
/* translators: 1: Duotone filter ID, 2: theme.json */
__( 'The duotone id "%1$s" is not registered in %2$s settings' ),
$filter_id,
'theme.json'
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
return;
Expand Down
10 changes: 9 additions & 1 deletion src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -3390,7 +3390,15 @@ public function set_spacing_sizes() {
|| ! is_numeric( $spacing_scale['mediumStep'] )
|| ( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ) {
if ( ! empty( $spacing_scale ) ) {
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid' ), E_USER_NOTICE );
trigger_error(
sprintf(
/* translators: 1: theme.json, 2: settings.spacing.spacingScale */
__( 'Some of the %1$s %2$s values are invalid' ),
'theme.json',
'settings.spacing.spacingScale'
),
E_USER_NOTICE
);
}
return null;
}
Expand Down

0 comments on commit cd5cf79

Please sign in to comment.