wp/wp-includes/customize/class-wp-customize-site-icon-control.php
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
child 22 8c2e4d02f4ef
--- a/wp/wp-includes/customize/class-wp-customize-site-icon-control.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/customize/class-wp-customize-site-icon-control.php	Fri Sep 05 18:40:08 2025 +0200
@@ -66,11 +66,47 @@
 							<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 bloginfo( 'name' ); ?>' ) #></span>
+							<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">