Make WordPress Core


Ignore:
Timestamp:
02/27/2024 08:19:51 PM (12 months ago)
Author:
jorbin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-site-icon-control.php

    r54526 r57730  
    6767
    6868                            <div class="favicon">
    69                                 <img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
     69                                <img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="{{
     70                                    data.attachment.alt ?
     71                                        wp.i18n.sprintf(
     72                                            <?php
     73                                            /* translators: %s: The selected image alt text. */
     74                                            echo wp_json_encode( __( 'Browser icon preview: Current image: %s' ) );
     75                                            ?>
     76                                            ,
     77                                            data.attachment.alt
     78                                        ) :
     79                                        wp.i18n.sprintf(
     80                                            <?php
     81                                            /* translators: %s: The selected image filename. */
     82                                            echo wp_json_encode( __( 'Browser icon preview: The current image has no alternative text. The file name is: %s' ) );
     83                                            ?>
     84                                            ,
     85                                            data.attachment.filename
     86                                        )
     87                                }}" />
    7088                            </div>
    7189                            <span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
    7290                        </div>
    73                         <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' ); ?>" />
     91                        <img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="{{
     92                            data.attachment.alt ?
     93                                wp.i18n.sprintf(
     94                                    <?php
     95                                    /* translators: %s: The selected image alt text. */
     96                                    echo wp_json_encode( __( 'App icon preview: Current image: %s' ) )
     97                                    ?>
     98                                    ,
     99                                    data.attachment.alt
     100                                ) :
     101                                wp.i18n.sprintf(
     102                                    <?php
     103                                    /* translators: %s: The selected image filename. */
     104                                    echo wp_json_encode( __( 'App icon preview: The current image has no alternative text. The file name is: %s' ) );
     105                                    ?>
     106                                    ,
     107                                    data.attachment.filename
     108                                )
     109                        }}"/>
    74110                    </div>
    75111                <# } #>
Note: See TracChangeset for help on using the changeset viewer.