Ticket #42140: 42140.4.patch
File 42140.4.patch, 9.8 KB (added by , 4 years ago) |
---|
-
src/js/_enqueues/wp/customize/controls.js
2119 2119 } 2120 2120 }); 2121 2121 if ( 'local' !== section.params.filter_type ) { 2122 wp.a11y.speak( api.settings.l10n.themeSearchResults.replace( '%d', data.info.results ) ); 2122 wp.a11y.speak( 2123 wp.i18n.sprintf( wp.i18n._n( '%d theme found', '%d themes found', data.info.results ), data.info.results ) 2124 ); 2123 2125 } 2124 2126 } 2125 2127 … … 2426 2428 * @return {void} 2427 2429 */ 2428 2430 updateCount: function( count ) { 2429 var section = this, countEl, displayed;2431 var section = this, i18n = wp.i18n, countEl, countText, displayed; 2430 2432 2431 2433 if ( ! count && 0 !== count ) { 2432 2434 count = section.getVisibleCount(); … … 2434 2436 2435 2437 displayed = section.contentContainer.find( '.themes-displayed' ); 2436 2438 countEl = section.contentContainer.find( '.theme-count' ); 2439 countText = i18n.sprintf( i18n._n( '%s theme', '%s themes', count ), count ); 2437 2440 2438 2441 if ( 0 === count ) { 2439 countEl.text( '0');2442 countEl.text( countText ); 2440 2443 } else { 2441 2444 2442 2445 // Animate the count change for emphasis. 2443 2446 displayed.fadeOut( 180, function() { 2444 countEl.text( count );2447 countEl.text( countText ); 2445 2448 displayed.fadeIn( 180 ); 2446 2449 } ); 2447 wp.a11y.speak( api.settings.l10n.announceThemeCount.replace( '%d', count ) ); 2450 wp.a11y.speak( 2451 i18n.sprintf( i18n._n( 'Displaying %d theme', 'Displaying %d themes', count ), count ) 2452 ); 2448 2453 } 2449 2454 }, 2450 2455 … … 5488 5493 control.setting.notifications.remove( 'csslint_error' ); 5489 5494 5490 5495 if ( 0 !== errorAnnotations.length ) { 5491 if ( 1 === errorAnnotations.length ) { 5492 message = api.l10n.customCssError.singular.replace( '%d', '1' ); 5493 } else { 5494 message = api.l10n.customCssError.plural.replace( '%d', String( errorAnnotations.length ) ); 5495 } 5496 message = wp.i18n.sprintf( 5497 wp.i18n._n( 5498 'There is %d error which must be fixed before you can save.', 5499 'There are %d errors which must be fixed before you can save.', 5500 errorAnnotations.length 5501 ), 5502 errorAnnotations.length 5503 ) 5504 5496 5505 control.setting.notifications.add( new api.Notification( 'csslint_error', { 5497 5506 message: message, 5498 5507 type: 'error' … … 7515 7524 7516 7525 if ( invalidSettings.length ) { 7517 7526 api.notifications.add( new api.Notification( errorCode, { 7518 message: ( 1 === invalidSettings.length ? api.l10n.saveBlockedError.singular : api.l10n.saveBlockedError.plural ).replace( /%s/g, String( invalidSettings.length ) ), 7527 message: wp.i18n.sprintf( 7528 wp.i18n._n( 7529 'Unable to save due to %s invalid setting.', 7530 'Unable to save due to %s invalid settings.', 7531 invalidSettings.length 7532 ), 7533 invalidSettings.length 7534 ), 7519 7535 type: 'error', 7520 7536 dismissible: true, 7521 7537 saveFailure: true -
src/wp-includes/class-wp-customize-manager.php
4901 4901 'previewableDevices' => $this->get_previewable_devices(), 4902 4902 'l10n' => array( 4903 4903 'confirmDeleteTheme' => __( 'Are you sure you want to delete this theme?' ), 4904 /* translators: %d: Number of theme search results, which cannot currently consider singular vs. plural forms. */4905 'themeSearchResults' => __( '%d themes found' ),4906 /* translators: %d: Number of themes being displayed, which cannot currently consider singular vs. plural forms. */4907 'announceThemeCount' => __( 'Displaying %d themes' ),4908 4904 /* translators: %s: Theme name. */ 4909 4905 'announceThemeDetails' => __( 'Showing details for theme: %s' ), 4910 4906 ), 4911 4907 ); 4912 4908 4909 // These strings are here for backwards compatibility; the translations now occur in JavaScript. 4910 /* translators: %d: Number of theme search results. Note there is a newer translation of this string with singular and plural forms. */ 4911 $settings['l10n']['themeSearchResults'] = __( '%d themes found' ); 4912 /* translators: %d: Number of themes being displayed. Note there is a newer translation of this string with singular and plural forms. */ 4913 $settings['l10n']['announceThemeCount'] = __( 'Displaying %d themes' ); 4914 4913 4915 // Temporarily disable installation in Customizer. See #42184. 4914 4916 $filesystem_method = get_filesystem_method(); 4915 4917 ob_start(); -
src/wp-includes/customize/class-wp-customize-themes-section.php
147 147 <# } #> 148 148 <div class="filter-themes-count"> 149 149 <span class="themes-displayed"> 150 <span class="theme-count"> 150 151 <?php 151 152 /* translators: %s: Number of themes displayed. */ 152 printf( _ _( '%s themes' ), '<span class="theme-count">0</span>' );153 printf( _n( '%s theme', '%s themes', '{{ data.count }}' ), '{{ data.count }}' ); 153 154 ?> 155 </span> 154 156 </span> 155 157 </div> 156 158 <?php -
src/wp-includes/script-loader.php
1141 1141 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 ); 1142 1142 $scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 ); 1143 1143 $scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 ); 1144 $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp- util', 'jquery-ui-core' ), false, 1 );1144 $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 ); 1145 1145 did_action( 'init' ) && $scripts->localize( 1146 1146 'customize-controls', 1147 1147 '_wpCustomizeControlsL10n', … … 1184 1184 'videoHeaderNotice' => __( 'This theme doesn’t support video headers on this page. Navigate to the front page or another page that supports video headers.' ), 1185 1185 // Used for overriding the file types allowed in Plupload. 1186 1186 'allowedFiles' => __( 'Allowed Files' ), 1187 'pageOnFrontError' => __( 'Homepage and posts page must be different.' ), 1188 'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ), 1189 'themePreviewUnavailable' => __( 'Sorry, you can’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.' ), 1190 'themeInstallUnavailable' => sprintf( 1191 /* translators: %s: URL to Add Themes admin screen. */ 1192 __( 'You won’t 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>.' ), 1193 esc_url( admin_url( 'theme-install.php' ) ) 1194 ), 1195 'publishSettings' => __( 'Publish Settings' ), 1196 'invalidDate' => __( 'Invalid date.' ), 1197 'invalidValue' => __( 'Invalid value.' ), 1198 // These strings are here for backward compatibility; the translations now occurs in JavaScript. 1187 1199 'customCssError' => array( 1188 1200 /* translators: %d: Error count. */ 1189 1201 '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 ), 1190 1202 /* translators: %d: Error count. */ 1191 1203 '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 ), 1192 // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.1193 1204 ), 1194 'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),1195 1205 'saveBlockedError' => array( 1196 1206 /* translators: %s: Number of invalid settings. */ 1197 1207 'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ), 1198 1208 /* translators: %s: Number of invalid settings. */ 1199 1209 'plural' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ), 1200 // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.1201 1210 ), 1202 'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),1203 'themePreviewUnavailable' => __( 'Sorry, you can’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.' ),1204 'themeInstallUnavailable' => sprintf(1205 /* translators: %s: URL to Add Themes admin screen. */1206 __( 'You won’t 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>.' ),1207 esc_url( admin_url( 'theme-install.php' ) )1208 ),1209 'publishSettings' => __( 'Publish Settings' ),1210 'invalidDate' => __( 'Invalid date.' ),1211 'invalidValue' => __( 'Invalid value.' ),1212 1211 ) 1213 1212 ); 1214 1213 $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );