Ticket #37290: 37290.4.diff
| File 37290.4.diff, 14.8 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/includes/ajax-actions.php
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php index 5e04365..9751bc5 100644
function wp_ajax_install_theme() { 3344 3344 wp_send_json_error( $status ); 3345 3345 } 3346 3346 3347 $status['themeName'] = wp_get_theme( $slug )->get( 'Name' ); 3348 3347 3349 if ( current_user_can( 'switch_themes' ) ) { 3348 3350 if ( is_multisite() ) { 3349 3351 $status['activateUrl'] = add_query_arg( array( -
src/wp-admin/includes/theme.php
diff --git src/wp-admin/includes/theme.php src/wp-admin/includes/theme.php index d758480..9bdfbcb 100644
function customize_themes_print_templates() { 635 635 <# if ( ! data.active ) { #> 636 636 <div class="theme-actions"> 637 637 <div class="inactive-theme"> 638 <a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a> 638 <?php 639 /* translators: %s: Theme name */ 640 $aria_label = sprintf( __( 'Preview %s' ), '{{ data.name }}' ); 641 ?> 642 <a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Live Preview' ); ?></a> 639 643 </div> 640 644 </div> 641 645 <# } #> -
src/wp-admin/includes/update.php
diff --git src/wp-admin/includes/update.php src/wp-admin/includes/update.php index 8845219..468b2af 100644
function wp_print_update_row_templates() { 716 716 <script id="tmpl-item-deleted-row" type="text/template"> 717 717 <tr class="plugin-deleted-tr inactive deleted" id="{{ data.slug }}-deleted" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>> 718 718 <td colspan="{{ data.colspan }}" class="plugin-update colspanchange"> 719 <# if ( data.plugin ) { #> 719 720 <?php 720 721 printf( 721 /* translators: %s: Plugin or Themename */722 _ _( '%s was successfully deleted.' ),722 /* translators: %s: Plugin name */ 723 _x( '%s was successfully deleted.', 'plugin' ), 723 724 '<strong>{{{ data.name }}}</strong>' 724 725 ); 725 726 ?> 727 <# } else { #> 728 <?php 729 printf( 730 /* translators: %s: Theme name */ 731 _x( '%s was successfully deleted.', 'theme' ), 732 '<strong>{{{ data.name }}}</strong>' 733 ); 734 ?> 735 <# } #> 726 736 </td> 727 737 </tr> 728 738 </script> -
src/wp-admin/js/updates.js
diff --git src/wp-admin/js/updates.js src/wp-admin/js/updates.js index 0de60b5..2a6e263 100644
508 508 $message.text( wp.updates.l10n.installing ); 509 509 } 510 510 511 $message.addClass( 'updating-message' ); 511 $message 512 .addClass( 'updating-message' ) 513 .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) ); 512 514 513 515 wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); 514 516 … … 535 537 $message 536 538 .removeClass( 'updating-message' ) 537 539 .addClass( 'updated-message installed button-disabled' ) 540 .attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) ) 538 541 .text( wp.updates.l10n.installed ); 539 542 540 543 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); … … 547 550 // Transform the 'Install' button into an 'Activate' button. 548 551 $message.removeClass( 'install-now installed button-disabled updated-message' ).addClass( 'activate-now button-primary' ) 549 552 .attr( 'href', response.activateUrl ) 553 .attr( 'aria-label', wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName ) ) 550 554 .text( wp.updates.l10n.activatePlugin ); 551 555 }, 1000 ); 552 556 } … … 595 599 596 600 $button 597 601 .removeClass( 'updating-message' ).addClass( 'button-disabled' ) 598 .attr( 'aria-label', wp.updates.l10n. installFailedLabel.replace( '%s', response.pluginName) )602 .attr( 'aria-label', wp.updates.l10n.pluginInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) 599 603 .text( wp.updates.l10n.installFailedShort ); 600 604 601 605 wp.a11y.speak( errorMessage, 'assertive' ); … … 1003 1007 $message.data( 'originaltext', $message.html() ); 1004 1008 } 1005 1009 1006 $message.text( wp.updates.l10n.installing ); 1010 $message 1011 .text( wp.updates.l10n.installing ) 1012 .attr( 'aria-label', wp.updates.l10n.themeInstallingLabel.replace( '%s', $message.data( 'name' ) ) ); 1007 1013 wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); 1008 1014 1009 1015 // Remove previous error messages, if any. … … 1032 1038 $message = $card.find( '.button-primary' ) 1033 1039 .removeClass( 'updating-message' ) 1034 1040 .addClass( 'updated-message disabled' ) 1041 .attr( 'aria-label', wp.updates.l10n.themeInstalledLabel.replace( '%s', response.themeName ) ) 1035 1042 .text( wp.updates.l10n.installed ); 1036 1043 1037 1044 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); 1038 1045 1039 1046 setTimeout( function() { 1040 1041 1047 if ( response.activateUrl ) { 1042 1048 1043 1049 // Transform the 'Install' button into an 'Activate' button. … … 1045 1051 .attr( 'href', response.activateUrl ) 1046 1052 .removeClass( 'theme-install updated-message disabled' ) 1047 1053 .addClass( 'activate' ) 1054 .attr( 'aria-label', wp.updates.l10n.activateThemeLabel.replace( '%s', response.themeName ) ) 1048 1055 .text( wp.updates.l10n.activateTheme ); 1049 1056 } 1050 1057 … … 1098 1105 1099 1106 $button 1100 1107 .removeClass( 'updating-message' ) 1101 .attr( 'aria-label', wp.updates.l10n. installFailedLabel.replace( '%s', $card.find( '.theme-name' ).text() ) )1108 .attr( 'aria-label', wp.updates.l10n.themeInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) 1102 1109 .text( wp.updates.l10n.installFailedShort ); 1103 1110 1104 1111 wp.a11y.speak( errorMessage, 'assertive' ); -
src/wp-admin/theme-install.php
diff --git src/wp-admin/theme-install.php src/wp-admin/theme-install.php index 646203e..33f9208 100644
if ( $tab ) { 248 248 249 249 <div class="theme-actions"> 250 250 <# if ( data.installed ) { #> 251 <?php 252 /* translators: %s: Theme name */ 253 $aria_label = sprintf( __( 'Activate %s' ), '{{ data.name }}' ); 254 ?> 251 255 <# 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 $aria_label; ?>"><?php esc_html_e( 'Activate' ); ?></a> 253 257 <# } #> 254 258 <# if ( data.customize_url ) { #> 255 259 <a class="button button-secondary load-customize" href="{{ data.customize_url }}"><?php esc_html_e( 'Live Preview' ); ?></a> … … if ( $tab ) { 257 261 <button class="button-secondary preview install-theme-preview"><?php esc_html_e( 'Preview' ); ?></button> 258 262 <# } #> 259 263 <# } else { #> 260 <a class="button button-primary theme-install" data-slug="{{ data.id }}" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a> 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 $aria_label; ?>"><?php esc_html_e( 'Install' ); ?></a> 261 269 <button class="button-secondary preview install-theme-preview"><?php esc_html_e( 'Preview' ); ?></button> 262 270 <# } #> 263 271 </div> … … if ( $tab ) { 276 284 <# if ( data.installed ) { #> 277 285 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php esc_html_e( 'Activate' ); ?></a> 278 286 <# } 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> 280 288 <# } #> 281 289 </div> 282 290 <div class="wp-full-overlay-sidebar-content"> -
src/wp-admin/themes.php
diff --git src/wp-admin/themes.php src/wp-admin/themes.php index 580318e..db01754 100644
foreach ( $themes as $theme ) : 277 277 <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> 278 278 <?php } ?> 279 279 <?php } else { ?> 280 <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a> 280 <?php 281 /* translators: %s: Theme name */ 282 $aria_label = sprintf( __( 'Activate %s' ), '{{ data.name }}' ); 283 ?> 284 <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 281 285 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 282 286 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 283 287 <?php } ?> … … $can_install = current_user_can( 'install_themes' ); 402 406 <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a> 403 407 <# } #> 404 408 <# } else { #> 405 <a class="button button-secondary activate" href="{{{ data.actions.activate }}}"><?php _e( 'Activate' ); ?></a> 409 <?php 410 /* translators: %s: Theme name */ 411 $aria_label = sprintf( __( 'Activate %s' ), '{{ data.name }}' ); 412 ?> 413 <a class="button button-secondary activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 406 414 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 407 415 <# } #> 408 416 </div> … … $can_install = current_user_can( 'install_themes' ); 456 464 <?php echo implode( ' ', $current_theme_actions ); ?> 457 465 </div> 458 466 <div class="inactive-theme"> 467 <?php 468 /* translators: %s: Theme name */ 469 $aria_label = sprintf( __( 'Activate %s' ), '{{ data.name }}' ); 470 ?> 459 471 <# if ( data.actions.activate ) { #> 460 <a href="{{{ data.actions.activate }}}" class="button button-secondary activate" ><?php _e( 'Activate' ); ?></a>472 <a href="{{{ data.actions.activate }}}" class="button button-secondary activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 461 473 <# } #> 462 474 <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> 463 475 </div> -
src/wp-includes/script-loader.php
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php index 2945b48..c2dadf2 100644
function wp_default_scripts( &$scripts ) { 628 628 'installFailedShort' => __( 'Install Failed!' ), 629 629 /* translators: Error string for a failed installation */ 630 630 'installFailed' => __( 'Installation failed: %s' ), 631 /* translators: Plugin/Theme name and version */ 632 'installingLabel' => __( 'Installing %s...' ), // no ellipsis 633 /* translators: Plugin/Theme name and version */ 634 'installedLabel' => __( '%s installed!' ), 635 /* translators: Plugin/Theme name and version */ 636 'installFailedLabel' => __( '%s installation failed' ), 631 /* translators: Plugin name and version */ 632 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // no ellipsis 633 /* translators: Theme name and version */ 634 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // no ellipsis 635 /* translators: Plugin name and version */ 636 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ), 637 /* translators: Theme name and version */ 638 'themeInstalledLabel' => _x( '%s installed!', 'theme' ), 639 /* translators: Plugin name and version */ 640 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ), 641 /* translators: Theme name and version */ 642 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ), 637 643 'installingMsg' => __( 'Installing... please wait.' ), 638 644 'installedMsg' => __( 'Installation completed successfully.' ), 639 645 /* translators: Activation URL */ … … function wp_default_scripts( &$scripts ) { 649 655 'deleteFailed' => __( 'Deletion failed: %s' ), 650 656 'deleted' => __( 'Deleted!' ), 651 657 'livePreview' => __( 'Live Preview' ), 658 /* translators: %s: Theme name */ 652 659 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ), 653 660 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ), 661 /* translators: %s: Plugin name */ 662 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ), 663 /* translators: %s: Theme name */ 664 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ), 654 665 'activateImporter' => __( 'Activate importer' ), 655 'unknownError' => __( 'An unknown error occur ed' ),666 'unknownError' => __( 'An unknown error occurred' ), 656 667 'pluginsFound' => __( 'Number of plugins found: %d' ), 657 668 'noPluginsFound' => __( 'No plugins found. Try a different search.' ), 658 669 ), -
tests/qunit/fixtures/updates.js
diff --git tests/qunit/fixtures/updates.js tests/qunit/fixtures/updates.js index d570aa6..8332039 100644
window._wpUpdatesSettings = { 22 22 'installed': 'Installed!', 23 23 'installFailedShort': 'Install Failed!', 24 24 'installFailed': 'Installation failed: %s', 25 'installingLabel': 'Installing %s...', // No ellipsis 26 'installedLabel': '%s installed!', 27 'installFailedLabel': '%s installation failed', 25 'pluginInstallingLabel': 'Installing %s...', // No ellipsis 26 'themeInstallingLabel': 'Installing %s...', // No ellipsis 27 'pluginInstalledLabel': '%s installed!', 28 'themeInstalledLabel': '%s installed!', 29 'pluginInstallFailedLabel': '%s installation failed', 30 'themeInstallFailedLabel': '%s installation failed', 28 31 'installingMsg': 'Installing... please wait.', 29 32 'installedMsg': 'Installation completed successfully.', 30 33 'importerInstalledMsg': 'Importer installed successfully. <a href="%s">Activate plugin & run importer</a>', … … window._wpUpdatesSettings = { 37 40 'deleted': 'Deleted!', 38 41 'livePreview': 'Live Preview', 39 42 'activatePlugin': 'Activate', 40 'activateTheme': 'Activate', 43 'activateTheme': 'Activate', 44 'activatePluginLabel': 'Activate %s', 45 'activateThemeLabel': 'Activate %s', 41 46 'activateImporter': 'Activate importer', 42 'unknownError': 'An unknown error occur ed',47 'unknownError': 'An unknown error occurred', 43 48 'pluginsFound': 'Number of plugins found: %d', 44 49 'noPluginsFound': 'No plugins found. Try a different search.' 45 50 }