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
This commit is contained in:
Aaron Jorbin 2024-02-27 20:21:14 +00:00
parent 023f523bda
commit 845a537170
3 changed files with 42 additions and 7 deletions

View File

@ -5198,10 +5198,9 @@ final class WP_Customize_Manager {
array(
'label' => __( 'Site Icon' ),
'description' => sprintf(
'<p>' . __( 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here!' ) . '</p>' .
/* translators: %s: Site icon size in pixels. */
'<p>' . __( 'Site Icons should be square and at least %s pixels.' ) . '</p>',
'<strong>512 &times; 512</strong>'
/* translators: %s: Site Icon size in pixels. */
'<p>' . __( '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.' ) . '</p>',
'<code>512 &times; 512</code>'
),
'section' => 'title_tagline',
'priority' => 60,

View File

@ -66,11 +66,47 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
<img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="" />
<div class="favicon">
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="{{
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
)
}}" />
</div>
<span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
</div>
<img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>" />
<img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="{{
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
)
}}"/>
</div>
<# } #>
<div class="actions">

View File

@ -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.