Make WordPress Core

Ticket #42140: 47719.4.diff

File 47719.4.diff, 10.0 KB (added by johnjamesjacoby, 11 months ago)

Refresh of 47719.3.patch for trunk/6.9

  • src/js/_enqueues/wp/customize/controls.js

     
    22 * @output wp-admin/js/customize-controls.js
    33 */
    44
    5 /* global _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */
     5/* global _, _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */
    66(function( exports, $ ){
    77        var Container, focus, normalizedTransitionendEventName, api = wp.customize;
    88
     
    21352135                                                        }
    21362136                                                });
    21372137                                                if ( 'local' !== section.params.filter_type ) {
    2138                                                         wp.a11y.speak( api.settings.l10n.themeSearchResults.replace( '%d', data.info.results ) );
     2138                                                        wp.a11y.speak(
     2139                                                                wp.i18n.sprintf(
     2140                                                                        wp.i18n._n(
     2141                                                                                '%d theme found',
     2142                                                                                '%d themes found',
     2143                                                                                data.info.results
     2144                                                                        ),
     2145                                                                        data.info.results
     2146                                                                )
     2147                                                        );
    21392148                                                }
    21402149                                        }
    21412150
     
    24392448                 *
    24402449                 * @since 4.9.0
    24412450                 *
     2451                 * @param {number} count New theme count.
    24422452                 * @return {void}
    24432453                 */
    24442454                updateCount: function( count ) {
    2445                         var section = this, countEl, displayed;
     2455                        var section = this, i18n = wp.i18n, countHtml, displayed;
    24462456
    24472457                        if ( ! count && 0 !== count ) {
    24482458                                count = section.getVisibleCount();
    24492459                        }
    24502460
    24512461                        displayed = section.contentContainer.find( '.themes-displayed' );
    2452                         countEl = section.contentContainer.find( '.theme-count' );
     2462                        countHtml = i18n.sprintf(
     2463                                i18n._n(
     2464                                        '%s theme',
     2465                                        '%s themes',
     2466                                        count
     2467                                ),
     2468                                '<span class="theme-count">' + count + '</span>'
     2469                        );
    24532470
    24542471                        if ( 0 === count ) {
    2455                                 countEl.text( '0' );
     2472                                displayed.html( countHtml );
    24562473                        } else {
    24572474
    24582475                                // Animate the count change for emphasis.
    24592476                                displayed.fadeOut( 180, function() {
    2460                                         countEl.text( count );
     2477                                        displayed.html( countHtml );
    24612478                                        displayed.fadeIn( 180 );
    24622479                                } );
    2463                                 wp.a11y.speak( api.settings.l10n.announceThemeCount.replace( '%d', count ) );
     2480                                wp.a11y.speak(
     2481                                        i18n.sprintf(
     2482                                                i18n._n(
     2483                                                        'Displaying %d theme',
     2484                                                        'Displaying %d themes',
     2485                                                        count
     2486                                                ),
     2487                                                count
     2488                                        )
     2489                                );
    24642490                        }
    24652491                },
    24662492
     
    55165542                        control.setting.notifications.remove( 'csslint_error' );
    55175543
    55185544                        if ( 0 !== errorAnnotations.length ) {
    5519                                 if ( 1 === errorAnnotations.length ) {
    5520                                         message = api.l10n.customCssError.singular.replace( '%d', '1' );
    5521                                 } else {
    5522                                         message = api.l10n.customCssError.plural.replace( '%d', String( errorAnnotations.length ) );
    5523                                 }
     5545                                message = wp.i18n.sprintf(
     5546                                        wp.i18n._n(
     5547                                                'There is %d error which must be fixed before you can save.',
     5548                                                'There are %d errors which must be fixed before you can save.',
     5549                                                errorAnnotations.length
     5550                                        ),
     5551                                        errorAnnotations.length
     5552                                );
     5553
    55245554                                control.setting.notifications.add( new api.Notification( 'csslint_error', {
    55255555                                        message: message,
    55265556                                        type: 'error'
     
    75437573
    75447574                                                if ( invalidSettings.length ) {
    75457575                                                        api.notifications.add( new api.Notification( errorCode, {
    7546                                                                 message: ( 1 === invalidSettings.length ? api.l10n.saveBlockedError.singular : api.l10n.saveBlockedError.plural ).replace( /%s/g, String( invalidSettings.length ) ),
     7576                                                                message: wp.i18n.sprintf(
     7577                                                                        wp.i18n._n(
     7578                                                                                'Unable to save due to %s invalid setting.',
     7579                                                                                'Unable to save due to %s invalid settings.',
     7580                                                                                invalidSettings.length
     7581                                                                        ),
     7582                                                                        invalidSettings.length
     7583                                                                ),
    75477584                                                                type: 'error',
    75487585                                                                dismissible: true,
    75497586                                                                saveFailure: true
  • src/wp-includes/class-wp-customize-manager.php

     
    49474947                        'previewableDevices'     => $this->get_previewable_devices(),
    49484948                        'l10n'                   => array(
    49494949                                'confirmDeleteTheme'   => __( 'Are you sure you want to delete this theme?' ),
    4950                                 /* translators: %d: Number of theme search results, which cannot currently consider singular vs. plural forms. */
    4951                                 'themeSearchResults'   => __( '%d themes found' ),
    4952                                 /* translators: %d: Number of themes being displayed, which cannot currently consider singular vs. plural forms. */
    4953                                 'announceThemeCount'   => __( 'Displaying %d themes' ),
    49544950                                /* translators: %s: Theme name. */
    49554951                                'announceThemeDetails' => __( 'Showing details for theme: %s' ),
    49564952                        ),
    49574953                );
    49584954
     4955                // These strings are here for backwards compatibility; the translations now occur in JavaScript.
     4956                /* translators: %d: Number of theme search results. Note there is a newer translation of this string with singular and plural forms. */
     4957                $settings['l10n']['themeSearchResults'] = __( '%d themes found' );
     4958                /* translators: %d: Number of themes being displayed. Note there is a newer translation of this string with singular and plural forms. */
     4959                $settings['l10n']['announceThemeCount'] = __( 'Displaying %d themes' );
     4960
    49594961                // Temporarily disable installation in Customizer. See #42184.
    49604962                $filesystem_method = get_filesystem_method();
    49614963                ob_start();
  • src/wp-includes/customize/class-wp-customize-themes-section.php

     
    166166                                <span class="themes-displayed">
    167167                                        <?php
    168168                                        /* translators: %s: Number of themes displayed. */
    169                                         printf( __( '%s themes' ), '<span class="theme-count">0</span>' );
     169                                        printf( _n( '%s theme', '%s themes', 0 ), '<span class="theme-count">0</span>' );
    170170                                        ?>
    171171                                </span>
    172172                        </div>
  • src/wp-includes/script-loader.php

     
    12831283        $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
    12841284        $scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
    12851285        $scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
    1286         $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
     1286        $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 );
    12871287        did_action( 'init' ) && $scripts->localize(
    12881288                'customize-controls',
    12891289                '_wpCustomizeControlsL10n',
     
    13261326                        'videoHeaderNotice'       => __( 'This theme does not support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
    13271327                        // Used for overriding the file types allowed in Plupload.
    13281328                        'allowedFiles'            => __( 'Allowed Files' ),
     1329                        'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
     1330                        'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
     1331                        'themePreviewUnavailable' => __( 'Sorry, you cannot 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.' ),
     1332                        'themeInstallUnavailable' => sprintf(
     1333                                /* translators: %s: URL to Add Themes admin screen. */
     1334                                __( 'You will not be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
     1335                                esc_url( admin_url( 'theme-install.php' ) )
     1336                        ),
     1337                        'publishSettings'         => __( 'Publish Settings' ),
     1338                        'invalidDate'             => __( 'Invalid date.' ),
     1339                        'invalidValue'            => __( 'Invalid value.' ),
     1340                        // These strings are here for backwards compatibility; the translations now occur in JavaScript.
    13291341                        'customCssError'          => array(
    13301342                                /* translators: %d: Error count. */
    13311343                                '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 ),
    13321344                                /* translators: %d: Error count. */
    13331345                                '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 ),
    1334                                 // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    13351346                        ),
    1336                         'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
    13371347                        'saveBlockedError'        => array(
    13381348                                /* translators: %s: Number of invalid settings. */
    13391349                                'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
    13401350                                /* translators: %s: Number of invalid settings. */
    13411351                                'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ),
    1342                                 // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    13431352                        ),
    1344                         'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
    1345                         'themePreviewUnavailable' => __( 'Sorry, you cannot 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.' ),
    1346                         'themeInstallUnavailable' => sprintf(
    1347                                 /* translators: %s: URL to Add Themes admin screen. */
    1348                                 __( 'You will not be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
    1349                                 esc_url( admin_url( 'theme-install.php' ) )
    1350                         ),
    1351                         'publishSettings'         => __( 'Publish Settings' ),
    1352                         'invalidDate'             => __( 'Invalid date.' ),
    1353                         'invalidValue'            => __( 'Invalid value.' ),
    13541353                        'blockThemeNotification'  => sprintf(
    13551354                                /* translators: 1: Link to Site Editor documentation on HelpHub, 2: HTML button. */
    13561355                                __( 'Hurray! Your theme supports site editing with blocks. <a href="%1$s">Tell me more</a>. %2$s' ),