Make WordPress Core

Ticket #26600: 26600.5.patch

File 26600.5.patch, 9.0 KB (added by afercia, 9 years ago)

better translatable string

  • src/wp-admin/css/themes.css

     
    11411141        font-size: 18px;
    11421142        font-style: normal;
    11431143        margin: 0;
    1144         padding: 100px 0 0;
     1144        padding: 0;
    11451145        text-align: center;
    11461146        display: none;
    11471147}
  • src/wp-admin/js/theme.js

     
    7979
    8080                // Render and append
    8181                this.view.render();
    82                 this.$el.find( '.themes' ).remove();
    83                 this.$el.append( this.view.el ).addClass( 'rendered' );
     82                this.$el.empty().append( this.view.el ).addClass('rendered');
    8483                this.$el.append( '<br class="clear"/>' );
    8584        },
    8685
     
    157156                // Useful for resetting the views when you clean the input
    158157                if ( this.terms === '' ) {
    159158                        this.reset( themes.data.themes );
     159                        $( 'body' ).removeClass( 'no-results' );
    160160                }
    161161
    162162                // Trigger an 'update' event
     
    831831        // The theme count element
    832832        count: $( '.wp-core-ui .theme-count' ),
    833833
     834        // The live themes count
     835        liveThemeCount: 0,
     836
    834837        initialize: function( options ) {
    835838                var self = this;
    836839
     
    854857                this.listenTo( self.collection, 'query:success', function( count ) {
    855858                        if ( _.isNumber( count ) ) {
    856859                                self.count.text( count );
     860                                self.announceSearchResults( count );
    857861                        } else {
    858862                                self.count.text( self.collection.length );
     863                                self.announceSearchResults( self.collection.length );
    859864                        }
    860865                });
    861866
     
    926931                }
    927932
    928933                // Display a live theme count for the collection
    929                 this.count.text( this.collection.count ? this.collection.count : this.collection.length );
     934                this.liveThemeCount = this.collection.count ? this.collection.count : this.collection.length;
     935                this.count.text( this.liveThemeCount );
     936
     937                this.announceSearchResults( this.liveThemeCount );
    930938        },
    931939
    932940        // Iterates through each instance of the collection
     
    10781086                        self.theme.trigger( 'theme:expand', previousModel.cid );
    10791087
    10801088                }
     1089        },
     1090
     1091        // Dispatch audible search results feedback message
     1092        announceSearchResults: function( count ) {
     1093                if ( 0 === count ) {
     1094                        wp.a11y.speak( l10n.noThemesFound );
     1095                } else {
     1096                        wp.a11y.speak( l10n.themesFound.replace( '%d', count ) );
     1097                }
    10811098        }
    10821099});
    10831100
     
    10911108
    10921109        attributes: {
    10931110                placeholder: l10n.searchPlaceholder,
    1094                 type: 'search'
     1111                type: 'search',
     1112                'aria-describedby': 'live-search-desc'
    10951113        },
    10961114
    10971115        events: {
     
    11131131        },
    11141132
    11151133        // Runs a search on the theme collection.
    1116         search: function( event ) {
     1134        search: _.debounce( function( event ) {
    11171135                var options = {};
    11181136
    11191137                // Clear on escape.
     
    11411159                } else {
    11421160                        themes.router.navigate( themes.router.baseUrl( '' ) );
    11431161                }
    1144         },
     1162        }, 250 ),
    11451163
    11461164        pushState: function( event ) {
    11471165                var url = themes.router.baseUrl( '' );
  • src/wp-admin/theme-install.php

     
    4444        ),
    4545        'l10n' => array(
    4646                'addNew' => __( 'Add New Theme' ),
    47                 'search'  => __( 'Search Themes' ),
     47                'search' => __( 'Search Themes' ),
    4848                'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis)
    4949                'upload' => __( 'Upload Theme' ),
    5050                'back'   => __( 'Back' ),
    51                 'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' )
     51                'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ),
     52                'themesFound'   => __( 'Number of Themes found: %d' ),
     53                'noThemesFound' => __( 'No themes found. Try a different search.' ),
    5254        ),
    5355        'installedThemes' => array_keys( $installed_themes ),
    5456) );
     
    7072
    7173$help_overview =
    7274        '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' .
    73         '<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.') . '</p>' .
     75        '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span> ' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
    7476        '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
    7577
    7678get_current_screen()->add_help_tab( array(
     
    166168                        </div>
    167169                </div>
    168170        </div>
    169         <div class="theme-browser content-filterable" aria-live="polite">
    170                 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    171         </div>
     171        <div class="theme-browser content-filterable"></div>
    172172        <div class="theme-install-overlay wp-full-overlay expanded"></div>
     173
     174        <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    173175        <span class="spinner"></span>
    174176
    175177        <br class="clear" />
  • src/wp-admin/themes.php

     
    4646                '<p>' . __( 'From this screen you can:' ) . '</p>' .
    4747                '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
    4848                '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
    49                 '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
     49                '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li>' .
     50                '<li>' . __( 'Search to filter the installed themes.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></li></ul>' .
    5051                '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>';
    5152
    5253        get_current_screen()->add_help_tab( array(
     
    107108                'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
    108109        ),
    109110        'l10n' => array(
    110                 'addNew' => __( 'Add New Theme' ),
    111                 'search'  => __( 'Search Installed Themes' ),
     111                'addNew'            => __( 'Add New Theme' ),
     112                'search'            => __( 'Search Installed Themes' ),
    112113                'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis)
     114                'themesFound'       => __( 'Number of Themes found: %d' ),
     115                'noThemesFound'     => __( 'No themes found. Try a different search.' ),
    113116        ),
    114117) );
    115118
     
    198201
    199202?>
    200203
    201 <div class="theme-browser" aria-live="polite">
     204<div class="theme-browser">
    202205        <div class="themes">
    203206
    204207<?php
     
    255258<?php endforeach; ?>
    256259        <br class="clear" />
    257260        </div>
    258         <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    259261</div>
    260262<div class="theme-overlay"></div>
    261263
     264<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     265
    262266<?php
    263267// List broken themes, if any.
    264268if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
  • src/wp-includes/script-loader.php

     
    499499
    500500                $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
    501501
    502                 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone' ), false, 1 );
     502                $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
    503503
    504504                $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
    505505                did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(