Ticket #42140: 47719.4.diff
| File 47719.4.diff, 10.0 KB (added by , 11 months ago) |
|---|
-
src/js/_enqueues/wp/customize/controls.js
2 2 * @output wp-admin/js/customize-controls.js 3 3 */ 4 4 5 /* global _ wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */5 /* global _, _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */ 6 6 (function( exports, $ ){ 7 7 var Container, focus, normalizedTransitionendEventName, api = wp.customize; 8 8 … … 2135 2135 } 2136 2136 }); 2137 2137 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 ); 2139 2148 } 2140 2149 } 2141 2150 … … 2439 2448 * 2440 2449 * @since 4.9.0 2441 2450 * 2451 * @param {number} count New theme count. 2442 2452 * @return {void} 2443 2453 */ 2444 2454 updateCount: function( count ) { 2445 var section = this, countEl, displayed;2455 var section = this, i18n = wp.i18n, countHtml, displayed; 2446 2456 2447 2457 if ( ! count && 0 !== count ) { 2448 2458 count = section.getVisibleCount(); 2449 2459 } 2450 2460 2451 2461 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 ); 2453 2470 2454 2471 if ( 0 === count ) { 2455 countEl.text( '0');2472 displayed.html( countHtml ); 2456 2473 } else { 2457 2474 2458 2475 // Animate the count change for emphasis. 2459 2476 displayed.fadeOut( 180, function() { 2460 countEl.text( count);2477 displayed.html( countHtml ); 2461 2478 displayed.fadeIn( 180 ); 2462 2479 } ); 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 ); 2464 2490 } 2465 2491 }, 2466 2492 … … 5516 5542 control.setting.notifications.remove( 'csslint_error' ); 5517 5543 5518 5544 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 5524 5554 control.setting.notifications.add( new api.Notification( 'csslint_error', { 5525 5555 message: message, 5526 5556 type: 'error' … … 7543 7573 7544 7574 if ( invalidSettings.length ) { 7545 7575 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 ), 7547 7584 type: 'error', 7548 7585 dismissible: true, 7549 7586 saveFailure: true -
src/wp-includes/class-wp-customize-manager.php
4947 4947 'previewableDevices' => $this->get_previewable_devices(), 4948 4948 'l10n' => array( 4949 4949 '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' ),4954 4950 /* translators: %s: Theme name. */ 4955 4951 'announceThemeDetails' => __( 'Showing details for theme: %s' ), 4956 4952 ), 4957 4953 ); 4958 4954 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 4959 4961 // Temporarily disable installation in Customizer. See #42184. 4960 4962 $filesystem_method = get_filesystem_method(); 4961 4963 ob_start(); -
src/wp-includes/customize/class-wp-customize-themes-section.php
166 166 <span class="themes-displayed"> 167 167 <?php 168 168 /* 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>' ); 170 170 ?> 171 171 </span> 172 172 </div> -
src/wp-includes/script-loader.php
1283 1283 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 ); 1284 1284 $scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 ); 1285 1285 $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 ); 1287 1287 did_action( 'init' ) && $scripts->localize( 1288 1288 'customize-controls', 1289 1289 '_wpCustomizeControlsL10n', … … 1326 1326 'videoHeaderNotice' => __( 'This theme does not support video headers on this page. Navigate to the front page or another page that supports video headers.' ), 1327 1327 // Used for overriding the file types allowed in Plupload. 1328 1328 '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. 1329 1341 'customCssError' => array( 1330 1342 /* translators: %d: Error count. */ 1331 1343 '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 ), 1332 1344 /* translators: %d: Error count. */ 1333 1345 '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.1335 1346 ), 1336 'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),1337 1347 'saveBlockedError' => array( 1338 1348 /* translators: %s: Number of invalid settings. */ 1339 1349 'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ), 1340 1350 /* translators: %s: Number of invalid settings. */ 1341 1351 '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.1343 1352 ), 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.' ),1354 1353 'blockThemeNotification' => sprintf( 1355 1354 /* translators: 1: Link to Site Editor documentation on HelpHub, 2: HTML button. */ 1356 1355 __( 'Hurray! Your theme supports site editing with blocks. <a href="%1$s">Tell me more</a>. %2$s' ),