From 845a5371703db4d4f26e4bcd40afdc49fcabf2a1 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 27 Feb 2024 20:21:14 +0000 Subject: [PATCH] Site Icon/Customizer: Update strings in customizer to align with `options-general.php`. This uses the new strings for alt text and site icon description that were introduced in [57713] as a part of #54370. The strings are translated in PHP and then use `wp.i18n.sprintf` since the alt text strings live in a PHP file even though they are output as part of a template that is used in JavaScript. Props westonruter, swissspidy, jorbin. Fixes #60641. Built from https://develop.svn.wordpress.org/trunk@57730 git-svn-id: http://core.svn.wordpress.org/trunk@57231 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 7 ++-- .../class-wp-customize-site-icon-control.php | 40 ++++++++++++++++++- wp-includes/version.php | 2 +- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index d12eea0e5f..51e979dfe0 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -5198,10 +5198,9 @@ final class WP_Customize_Manager { array( 'label' => __( 'Site Icon' ), 'description' => sprintf( - '

' . __( 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here!' ) . '

' . - /* translators: %s: Site icon size in pixels. */ - '

' . __( 'Site Icons should be square and at least %s pixels.' ) . '

', - '512 × 512' + /* translators: %s: Site Icon size in pixels. */ + '

' . __( 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. They should be square and at least %s pixels.' ) . '

', + '512 × 512' ), 'section' => 'title_tagline', 'priority' => 60, diff --git a/wp-includes/customize/class-wp-customize-site-icon-control.php b/wp-includes/customize/class-wp-customize-site-icon-control.php index 942000a57d..33694b2a60 100644 --- a/wp-includes/customize/class-wp-customize-site-icon-control.php +++ b/wp-includes/customize/class-wp-customize-site-icon-control.php @@ -66,11 +66,47 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
- <?php esc_attr_e( 'Preview as a browser icon' ); ?> + {{
+									data.attachment.alt ?
+										wp.i18n.sprintf(
+											<?php
+											/* translators: %s: The selected image alt text. */
+											echo wp_json_encode( __( 'Browser icon preview: Current image: %s' ) );
+											?>
+											,
+											data.attachment.alt
+										) :
+										wp.i18n.sprintf(
+											<?php
+											/* translators: %s: The selected image filename. */
+											echo wp_json_encode( __( 'Browser icon preview: The current image has no alternative text. The file name is: %s' ) );
+											?>
+											,
+											data.attachment.filename
+										)
+								}}
- <?php esc_attr_e( 'Preview as an app icon' ); ?> + {{
+							data.attachment.alt ?
+								wp.i18n.sprintf(
+									<?php
+									/* translators: %s: The selected image alt text. */
+									echo wp_json_encode( __( 'App icon preview: Current image: %s' ) )
+									?>
+									,
+									data.attachment.alt
+								) :
+								wp.i18n.sprintf(
+									<?php
+									/* translators: %s: The selected image filename. */
+									echo wp_json_encode( __( 'App icon preview: The current image has no alternative text. The file name is: %s' ) );
+									?>
+									,
+									data.attachment.filename
+								)
+						}} <# } #>
diff --git a/wp-includes/version.php b/wp-includes/version.php index 4043a32009..2316ed0a25 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta3-57729'; +$wp_version = '6.5-beta3-57730'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.