Make WordPress Core


Ignore:
Timestamp:
07/13/2016 05:31:15 PM (10 years ago)
Author:
ocean90
Message:

Update/Install: Give context to some install/update strings to allow for differentiation between theme and plugin translations.

Props swissspidy, SergeyBiryukov.
Fixes #37290.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-install.php

    r37914 r38057  
    249249        <div class="theme-actions">
    250250                <# if ( data.installed ) { #>
     251                        <?php
     252                        /* translators: %s: Theme name */
     253                        $aria_label = sprintf( __( 'Activate %s' ), '{{ data.name }}' );
     254                        ?>
    251255                        <# if ( data.activate_url ) { #>
    252                                 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php esc_html_e( 'Activate' ); ?></a>
     256                                <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
    253257                        <# } #>
    254258                        <# if ( data.customize_url ) { #>
    255                                 <a class="button button-secondary load-customize" href="{{ data.customize_url }}"><?php esc_html_e( 'Live Preview' ); ?></a>
     259                                <a class="button button-secondary load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
    256260                        <# } else { #>
    257                                 <button class="button-secondary preview install-theme-preview"><?php esc_html_e( 'Preview' ); ?></button>
     261                                <button class="button-secondary preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
    258262                        <# } #>
    259263                <# } else { #>
    260                         <a class="button button-primary theme-install" data-slug="{{ data.id }}" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
    261                         <button class="button-secondary preview install-theme-preview"><?php esc_html_e( 'Preview' ); ?></button>
     264                        <?php
     265                        /* translators: %s: Theme name */
     266                        $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
     267                        ?>
     268                        <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
     269                        <button class="button-secondary preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
    262270                <# } #>
    263271        </div>
    … …  
    275283                        <button class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></button>
    276284                        <# if ( data.installed ) { #>
    277                                 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php esc_html_e( 'Activate' ); ?></a>
     285                                <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
    278286                        <# } else { #>
    279                                 <a href="{{ data.install_url }}" class="button button-primary theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
     287                                <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
    280288                        <# } #>
    281289                </div>
Note: See TracChangeset for help on using the changeset viewer.