Changeset 45178
- Timestamp:
- 04/12/2019 08:33:48 PM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/site-health.js
r45176 r45178 9 9 jQuery( document ).ready( function( $ ) { 10 10 11 var __ = wp.i18n.__, 12 _n = wp.i18n._n, 13 sprintf = wp.i18n.sprintf; 14 11 15 var data; 12 16 var clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ); … … 18 22 $( '.success', $wrapper ).addClass( 'visible' ); 19 23 20 wp.a11y.speak( SiteHealth.string.site_info_copied);24 wp.a11y.speak( __( 'Site information has been added to your clipboard.' ) ); 21 25 } ); 22 26 … … 53 57 var template = wp.template( 'health-check-issue' ), 54 58 issueWrapper = $( '#health-check-issues-' + issue.status ), 55 issueCounter = $( '.issue-count', issueWrapper );59 heading; 56 60 57 61 SiteHealth.site_status.issues[ issue.status ]++; 58 62 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 heading = sprintf( _n( '%s Critical issue', '%s Critical issues', count ), '<span class="issue-count">' + count + '</span>' ); 67 } else if ( 'recommended' === issue.status ) { 68 heading = sprintf( _n( '%s Recommended improvement', '%s Recommended improvements', count ), '<span class="issue-count">' + count + '</span>' ); 69 } else if ( 'good' === issue.status ) { 70 heading = 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 ( heading ) { 74 $( '> h3', issueWrapper ).html( heading ); 75 } 76 60 77 $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) ); 61 78 } … … 129 146 ); 130 147 131 wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ) ); 148 // translators: %s: The percentage score for the tests. 149 var text = __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ); 150 wp.a11y.speak( sprintf( text, val + '%' ) ); 132 151 } 133 152 } … … 222 241 // After 3 seconds announce that we're still waiting for directory sizes. 223 242 var timeout = window.setTimeout( function() { 224 wp.a11y.speak( SiteHealth.string.please_wait);243 wp.a11y.speak( __( 'Please wait...' ) ); 225 244 }, 3000 ); 226 245 … … 249 268 250 269 window.setTimeout( function() { 251 wp.a11y.speak( SiteHealth.string.site_health_complete);270 wp.a11y.speak( __( 'All site health tests have finished running.' ) ); 252 271 }, delay ); 253 272 } else { -
trunk/src/wp-admin/includes/class-wp-site-health.php
r45170 r45178 47 47 $health_check_js_variables = array( 48 48 '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 ),60 49 'nonce' => array( 61 50 'site_status' => wp_create_nonce( 'health-check-site-status' ), -
trunk/src/wp-admin/site-health.php
r45099 r45178 92 92 <div class="site-health-issues-wrapper" id="health-check-issues-critical"> 93 93 <h3> 94 < span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>94 <?php printf( _n( '%s Critical issue', '%s Critical issues', 0 ), '<span class="issue-count">0</span>' ); ?> 95 95 </h3> 96 96 … … 100 100 <div class="site-health-issues-wrapper" id="health-check-issues-recommended"> 101 101 <h3> 102 < span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?>102 <?php printf( _n( '%s Recommended improvement', '%s Recommended improvements', 0 ), '<span class="issue-count">0</span>' ); ?> 103 103 </h3> 104 104 -
trunk/src/wp-includes/script-loader.php
r45168 r45178 1691 1691 ); 1692 1692 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 ); 1694 1694 1695 1695 $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.