Make WordPress Core

Ticket #42140: 42140.diff

File 42140.diff, 9.7 KB (added by dlh, 5 years ago)
  • src/js/_enqueues/wp/customize/controls.js

    diff --git src/js/_enqueues/wp/customize/controls.js src/js/_enqueues/wp/customize/controls.js
    index 6c92362410..b45d30555c 100644
     
    21172117                                                        }
    21182118                                                });
    21192119                                                if ( 'local' !== section.params.filter_type ) {
    2120                                                         wp.a11y.speak( api.settings.l10n.themeSearchResults.replace( '%d', data.info.results ) );
     2120                                                        wp.a11y.speak(
     2121                                                                wp.i18n.sprintf(
     2122                                                                        wp.i18n._n( '%d theme found', '%d themes found', data.info.results ), data.info.results
     2123                                                                )
     2124                                                        );
    21212125                                                }
    21222126                                        }
    21232127
     
    24212425                 * @return {void}
    24222426                 */
    24232427                updateCount: function( count ) {
    2424                         var section = this, countEl, displayed;
     2428                        var section = this, i18n = wp.i18n, countEl, countText, displayed;
    24252429
    24262430                        if ( ! count && 0 !== count ) {
    24272431                                count = section.getVisibleCount();
     
    24292433
    24302434                        displayed = section.contentContainer.find( '.themes-displayed' );
    24312435                        countEl = section.contentContainer.find( '.theme-count' );
     2436                        countText = i18n.sprintf( i18n._n( '%s theme', '%s themes', count ), count );
    24322437
    24332438                        if ( 0 === count ) {
    2434                                 countEl.text( '0' );
     2439                                countEl.text( countText );
    24352440                        } else {
    24362441
    24372442                                // Animate the count change for emphasis.
    24382443                                displayed.fadeOut( 180, function() {
    2439                                         countEl.text( count );
     2444                                        countEl.text( countText );
    24402445                                        displayed.fadeIn( 180 );
    24412446                                } );
    2442                                 wp.a11y.speak( api.settings.l10n.announceThemeCount.replace( '%d', count ) );
     2447                                wp.a11y.speak(i18n.sprintf( i18n._n( 'Displaying %d theme', 'Displaying %d themes', count ), count ) );
    24432448                        }
    24442449                },
    24452450
     
    54805485                        control.setting.notifications.remove( 'csslint_error' );
    54815486
    54825487                        if ( 0 !== errorAnnotations.length ) {
    5483                                 if ( 1 === errorAnnotations.length ) {
    5484                                         message = api.l10n.customCssError.singular.replace( '%d', '1' );
    5485                                 } else {
    5486                                         message = api.l10n.customCssError.plural.replace( '%d', String( errorAnnotations.length ) );
    5487                                 }
     5488                                message = wp.i18n.sprintf(
     5489                                        wp.i18n._n(
     5490                                                'There is %d error which must be fixed before you can save.',
     5491                                                'There are %d errors which must be fixed before you can save.',
     5492                                                errorAnnotations.length
     5493                                        ),
     5494                                        errorAnnotations.length
     5495                                )
     5496
    54885497                                control.setting.notifications.add( new api.Notification( 'csslint_error', {
    54895498                                        message: message,
    54905499                                        type: 'error'
     
    75027511
    75037512                                                if ( invalidSettings.length ) {
    75047513                                                        api.notifications.add( new api.Notification( errorCode, {
    7505                                                                 message: ( 1 === invalidSettings.length ? api.l10n.saveBlockedError.singular : api.l10n.saveBlockedError.plural ).replace( /%s/g, String( invalidSettings.length ) ),
     7514                                                                message: wp.i18n.sprintf(
     7515                                                                        wp.i18n._n(
     7516                                                                                'Unable to save due to %s invalid setting.',
     7517                                                                                'Unable to save due to %s invalid settings.',
     7518                                                                                invalidSettings.length
     7519                                                                        ),
     7520                                                                        invalidSettings.length
     7521                                                                ),
    75067522                                                                type: 'error',
    75077523                                                                dismissible: true,
    75087524                                                                saveFailure: true
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index decf0b87cf..0e29d3b337 100644
    final class WP_Customize_Manager { 
    48654865                        'previewableDevices'     => $this->get_previewable_devices(),
    48664866                        'l10n'                   => array(
    48674867                                'confirmDeleteTheme'   => __( 'Are you sure you want to delete this theme?' ),
    4868                                 /* translators: %d: Number of theme search results, which cannot currently consider singular vs. plural forms. */
    4869                                 'themeSearchResults'   => __( '%d themes found' ),
    4870                                 /* translators: %d: Number of themes being displayed, which cannot currently consider singular vs. plural forms. */
    4871                                 'announceThemeCount'   => __( 'Displaying %d themes' ),
    48724868                                /* translators: %s: Theme name. */
    48734869                                'announceThemeDetails' => __( 'Showing details for theme: %s' ),
    48744870                        ),
    48754871                );
    48764872
     4873                // These strings are here for backwards compatibility; the translations now occur in JavaScript.
     4874                /* translators: %d: Number of theme search results. Note there is a newer translation of this string with singular and plural forms. */
     4875                $settings['l10n']['themeSearchResults'] = __( '%d themes found' );
     4876                /* translators: %d: Number of themes being displayed. Note there is a newer translation of this string with singular and plural forms. */
     4877                $settings['l10n']['announceThemeCount'] = __( 'Displaying %d themes' );
     4878
    48774879                // Temporarily disable installation in Customizer. See #42184.
    48784880                $filesystem_method = get_filesystem_method();
    48794881                ob_start();
  • src/wp-includes/customize/class-wp-customize-themes-section.php

    diff --git src/wp-includes/customize/class-wp-customize-themes-section.php src/wp-includes/customize/class-wp-customize-themes-section.php
    index 14db083e70..f0f365f5d1 100644
    class WP_Customize_Themes_Section extends WP_Customize_Section { 
    147147                <# } #>
    148148                <div class="filter-themes-count">
    149149                        <span class="themes-displayed">
    150                                 <?php
    151                                 /* translators: %s: Number of themes displayed. */
    152                                 echo sprintf( __( '%s themes' ), '<span class="theme-count">0</span>' );
    153                                 ?>
     150                                <span class="theme-count">
     151                                        <?php
     152                                        /* translators: %s: Number of themes displayed. */
     153                                        printf( _n( '%s theme', '%s themes', 0 ), 0 );
     154                                        ?>
     155                                </span>
    154156                        </span>
    155157                </div>
    156158                <?php
  • src/wp-includes/script-loader.php

    diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
    index 5452ff0848..343395b04f 100644
    function wp_default_scripts( &$scripts ) { 
    15201520        $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
    15211521        $scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
    15221522        $scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
    1523         $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
     1523        $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-i18n', 'wp-util', 'jquery-ui-core' ), false, 1 );
    15241524        did_action( 'init' ) && $scripts->localize(
    15251525                'customize-controls',
    15261526                '_wpCustomizeControlsL10n',
    function wp_default_scripts( &$scripts ) { 
    15631563                        'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
    15641564                        // Used for overriding the file types allowed in plupload.
    15651565                        'allowedFiles'            => __( 'Allowed Files' ),
    1566                         'customCssError'          => array(
    1567                                 /* translators: %d: Error count. */
    1568                                 'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),
    1569                                 /* translators: %d: Error count. */
    1570                                 'plural'   => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    1571                         ),
    15721566                        'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
    1573                         'saveBlockedError'        => array(
    1574                                 /* translators: %s: Number of invalid settings. */
    1575                                 'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
    1576                                 /* translators: %s: Number of invalid settings. */
    1577                                 'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    1578                         ),
    15791567                        'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
    15801568                        'themePreviewUnavailable' => __( 'Sorry, you can&#8217;t preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ),
    15811569                        'themeInstallUnavailable' => sprintf(
    function wp_default_scripts( &$scripts ) { 
    15861574                        'publishSettings'         => __( 'Publish Settings' ),
    15871575                        'invalidDate'             => __( 'Invalid date.' ),
    15881576                        'invalidValue'            => __( 'Invalid value.' ),
     1577                        // These strings are here for backward compatibility; the translations now occurs in JavaScript.
     1578                        'customCssError'          => array(
     1579                                /* translators: %d: Error count. */
     1580                                'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),
     1581                                /* translators: %d: Error count. */
     1582                                'plural'   => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ),
     1583                        ),
     1584                        'saveBlockedError'        => array(
     1585                                /* translators: %s: Number of invalid settings. */
     1586                                'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
     1587                                /* translators: %s: Number of invalid settings. */
     1588                                'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ),
     1589                        ),
    15891590                )
    15901591        );
    15911592        $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );