Make WordPress Core

Ticket #46683: 46683.diff

File 46683.diff, 6.7 KB (added by TimothyBlynJacobs, 6 years ago)
  • src/js/_enqueues/admin/site-health.js

    diff --git a/src/js/_enqueues/admin/site-health.js b/src/js/_enqueues/admin/site-health.js
    index 1a31be1b5e..54786dce6f 100644
    a b  
    88
    99jQuery( document ).ready( function( $ ) {
    1010
     11        var __ = wp.i18n.__,
     12                _n = wp.i18n._n,
     13                sprintf = wp.i18n.sprintf;
     14
    1115        var data;
    1216
    1317        var clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' );
    jQuery( document ).ready( function( $ ) { 
    1721                var $wrapper = $( e.trigger ).closest( 'div' );
    1822                $( '.success', $wrapper ).addClass( 'visible' );
    1923
    20                 wp.a11y.speak( SiteHealth.string.site_info_copied );
     24                wp.a11y.speak( __( 'Site information has been added to your clipboard.' ) );
    2125        } );
    2226
    2327        // Accordion handling in various areas.
    jQuery( document ).ready( function( $ ) { 
    5256        function AppendIssue( issue ) {
    5357                var template = wp.template( 'health-check-issue' ),
    5458                        issueWrapper = $( '#health-check-issues-' + issue.status ),
    55                         issueCounter = $( '.issue-count', issueWrapper );
     59                        headline;
    5660
    5761                SiteHealth.site_status.issues[ issue.status ]++;
    5862
    59                 issueCounter.text( SiteHealth.site_status.issues[ issue.status ] );
     63                var count = SiteHealth.site_status.issues[ issue.status ];
     64
     65                if ( 'critical' === issue.status ) {
     66                        headline = sprintf( _n( '%s Critical issue', '%s Critical issues', count ), '<span class="issue-count">' + count + '</span>' );
     67                } else if ( 'recommended' === issue.status ) {
     68                        headline = sprintf( _n( '%s Recommended improvement', '%s Recommended improvements', count ), '<span class="issue-count">' + count + '</span>' );
     69                } else if ( 'good' === issue.status ) {
     70                        headline = sprintf( _n( '%s Item with no issues detected', '%s Items with no issues detected', count ), '<span class="issue-count">' + count + '</span>' );
     71                }
     72
     73                if ( headline ) {
     74                        $( '> h3', issueWrapper ).html( headline );
     75                }
     76
    6077                $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) );
    6178        }
    6279
    jQuery( document ).ready( function( $ ) { 
    127144                        }
    128145                );
    129146
    130                 wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ) );
     147                // translators: %s: The percentage score for the tests.
     148                var text = __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' );
     149                wp.a11y.speak( sprintf( text, val + '%' ) );
    131150        }
    132151
    133152        /**
  • src/wp-admin/includes/class-wp-site-health.php

    diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
    index 85420f4b8d..181d48a19f 100644
    a b class WP_Site_Health { 
    4646
    4747                $health_check_js_variables = array(
    4848                        'screen'      => $screen->id,
    49                         'string'      => array(
    50                                 'please_wait'                        => __( 'Please wait...' ),
    51                                 'copied'                             => __( 'Copied' ),
    52                                 'running_tests'                      => __( 'Currently being tested...' ),
    53                                 'site_health_complete'               => __( 'All site health tests have finished running.' ),
    54                                 'site_info_show_copy'                => __( 'Show options for copying this information' ),
    55                                 'site_info_hide_copy'                => __( 'Hide options for copying this information' ),
    56                                 // translators: %s: The percentage score for the tests.
    57                                 'site_health_complete_screen_reader' => __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ),
    58                                 'site_info_copied'                   => __( 'Site information has been added to your clipboard.' ),
    59                         ),
    6049                        'nonce'       => array(
    6150                                'site_status'        => wp_create_nonce( 'health-check-site-status' ),
    6251                                'site_status_result' => wp_create_nonce( 'health-check-site-status-result' ),
  • src/wp-admin/site-health-info.php

    diff --git a/src/wp-admin/site-health-info.php b/src/wp-admin/site-health-info.php
    index 1ab31f64af..1d26329909 100644
    a b require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    8787        <div class="site-health-copy-buttons">
    8888                <div class="copy-button-wrapper">
    8989                        <button type="button" class="button button-primary copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard' ); ?></button>
    90                         <span class="success" aria-hidden="true">Copied!</span>
     90                        <span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
    9191                </div>
    9292                <?php if ( $english_info ) : ?>
    9393                        <div class="copy-button-wrapper">
    9494                                <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $english_info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard (English)' ); ?></button>
    95                                 <span class="success" aria-hidden="true">Copied!</span>
     95                                <span class="success" aria-hidden="true"><?php _e( 'Copied!' ) ?></span>
    9696                        </div>
    9797                <?php endif; ?>
    9898        </div>
  • src/wp-admin/site-health.php

    diff --git a/src/wp-admin/site-health.php b/src/wp-admin/site-health.php
    index cc4543e436..7941887ab1 100644
    a b require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    9191
    9292                <div class="site-health-issues-wrapper" id="health-check-issues-critical">
    9393                        <h3>
    94                                 <span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>
     94                                <span class="issue-count">0</span> <?php echo _n( 'Critical issue', 'Critical issues', 0 ); ?>
    9595                        </h3>
    9696
    9797                        <div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    9999
    100100                <div class="site-health-issues-wrapper" id="health-check-issues-recommended">
    101101                        <h3>
    102                                 <span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?>
     102                                <span class="issue-count">0</span> <?php echo _n( 'Recommended improvement', 'Recommended improvements', 0 ); ?>
    103103                        </h3>
    104104
    105105                        <div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index 3a3f57eded..ada3af1064 100644
    a b function wp_default_scripts( &$scripts ) { 
    16901690                        )
    16911691                );
    16921692
    1693                 $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
     1693                $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
    16941694
    16951695                $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
    16961696                did_action( 'init' ) && $scripts->localize(