Changeset 47884
- Timestamp:
- 06/01/2020 09:39:30 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/theme.js
r47883 r47884 800 800 $( document ).off( 'wp-auto-update-setting-changed', callback ); 801 801 } 802 } 802 }; 803 803 804 804 // Triggered in updates.js -
trunk/src/js/_enqueues/wp/updates.js
r47883 r47884 13 13 * @param {object} settings WP Updates settings. 14 14 * @param {string} settings.ajax_nonce AJAX nonce. 15 * @param {object} settings.l10n Translation strings.16 15 * @param {object=} settings.plugins Base names of plugins in their different states. 17 16 * @param {Array} settings.plugins.all Base names of all plugins. … … 28 27 */ 29 28 (function( $, wp, settings ) { 30 var $document = $( document ); 29 var $document = $( document ), 30 __ = wp.i18n.__, 31 _x = wp.i18n._x, 32 sprintf = wp.i18n.sprintf; 31 33 32 34 wp = wp || {}; … … 49 51 */ 50 52 wp.updates.ajaxNonce = settings.ajax_nonce; 51 52 /**53 * Localized strings.54 *55 * @since 4.2.056 *57 * @type {object}58 */59 wp.updates.l10n = settings.l10n;60 53 61 54 /** … … 382 375 $updateRow = $( 'tr[data-plugin="' + args.plugin + '"]' ); 383 376 $message = $updateRow.find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' ); 384 message = wp.updates.l10n.pluginUpdatingLabel.replace( '%s', $updateRow.find( '.plugin-title strong' ).text() ); 377 message = sprintf( 378 /* translators: %s: Plugin name and version. */ 379 _x( 'Updating %s...', 'plugin' ), 380 $updateRow.find( '.plugin-title strong' ).text() 381 ); 385 382 } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) { 386 383 $card = $( '.plugin-card-' + args.slug ); 387 384 $message = $card.find( '.update-now' ).addClass( 'updating-message' ); 388 message = wp.updates.l10n.pluginUpdatingLabel.replace( '%s', $message.data( 'name' ) ); 385 message = sprintf( 386 /* translators: %s: Plugin name and version. */ 387 _x( 'Updating %s...', 'plugin' ), 388 $message.data( 'name' ) 389 ); 389 390 390 391 // Remove previous error messages, if any. … … 392 393 } 393 394 394 if ( $message.html() !== wp.updates.l10n.updating) {395 if ( $message.html() !== __( 'Updating...' ) ) { 395 396 $message.data( 'originaltext', $message.html() ); 396 397 } … … 398 399 $message 399 400 .attr( 'aria-label', message ) 400 .text( wp.updates.l10n.updating);401 .text( __( 'Updating...' ) ); 401 402 402 403 $document.trigger( 'wp-plugin-updating', args ); … … 443 444 444 445 $updateMessage 445 .attr( 'aria-label', wp.updates.l10n.pluginUpdatedLabel.replace( '%s', response.pluginName ) ) 446 .text( wp.updates.l10n.pluginUpdated ); 447 448 wp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' ); 446 .attr( 447 'aria-label', 448 sprintf( 449 /* translators: %s: Plugin name and version. */ 450 _x( '%s updated!', 'plugin' ), 451 response.pluginName 452 ) 453 ) 454 .text( _x( 'Updated!', 'plugin' ) ); 455 456 wp.a11y.speak( __( 'Update completed successfully.' ), 'polite' ); 449 457 450 458 wp.updates.decrementCount( 'plugin' ); … … 477 485 } 478 486 479 errorMessage = wp.updates.l10n.updateFailed.replace( '%s', response.errorMessage ); 487 errorMessage = sprintf( 488 /* translators: %s: Error string for a failed update. */ 489 __( 'Update Failed: %s' ), 490 response.errorMessage 491 ); 480 492 481 493 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { … … 489 501 if ( response.pluginName ) { 490 502 $message.find( 'p' ) 491 .attr( 'aria-label', wp.updates.l10n.pluginUpdateFailedLabel.replace( '%s', response.pluginName ) ); 503 .attr( 504 'aria-label', 505 sprintf( 506 /* translators: %s: Plugin name and version. */ 507 _x( '%s update failed', 'plugin' ), 508 response.pluginName 509 ) 510 ); 492 511 } else { 493 512 $message.find( 'p' ).removeAttr( 'aria-label' ); … … 502 521 503 522 $card.find( '.update-now' ) 504 .text( wp.updates.l10n.updateFailedShort ).removeClass( 'updating-message' ); 523 .text( __( 'Update Failed!' ) ) 524 .removeClass( 'updating-message' ); 505 525 506 526 if ( response.pluginName ) { 507 527 $card.find( '.update-now' ) 508 .attr( 'aria-label', wp.updates.l10n.pluginUpdateFailedLabel.replace( '%s', response.pluginName ) ); 528 .attr( 529 'aria-label', 530 sprintf( 531 /* translators: %s: Plugin name and version. */ 532 _x( '%s update failed', 'plugin' ), 533 response.pluginName 534 ) 535 ); 509 536 } else { 510 537 $card.find( '.update-now' ).removeAttr( 'aria-label' ); … … 521 548 $card.find( '.update-now' ) 522 549 .attr( 'aria-label', false ) 523 .text( wp.updates.l10n.updateNow);550 .text( __( 'Update Now' ) ); 524 551 }, 200 ); 525 552 } ); … … 556 583 } 557 584 558 if ( $message.html() !== wp.updates.l10n.installing) {585 if ( $message.html() !== __( 'Installing...' ) ) { 559 586 $message.data( 'originaltext', $message.html() ); 560 587 } … … 562 589 $message 563 590 .addClass( 'updating-message' ) 564 .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) ) 565 .text( wp.updates.l10n.installing ); 566 567 wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); 591 .attr( 592 'aria-label', 593 sprintf( 594 /* translators: %s: Plugin name and version. */ 595 _x( 'Installing %s...', 'plugin' ), 596 $message.data( 'name' ) 597 ) 598 ) 599 .text( __( 'Installing...' ) ); 600 601 wp.a11y.speak( __( 'Installing... please wait.' ), 'polite' ); 568 602 569 603 // Remove previous error messages, if any. … … 591 625 .removeClass( 'updating-message' ) 592 626 .addClass( 'updated-message installed button-disabled' ) 593 .attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) ) 594 .text( wp.updates.l10n.pluginInstalled ); 595 596 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); 627 .attr( 628 'aria-label', 629 sprintf( 630 /* translators: %s: Plugin name and version. */ 631 _x( '%s installed!', 'plugin' ), 632 response.pluginName 633 ) 634 ) 635 .text( _x( 'Installed!', 'plugin' ) ); 636 637 wp.a11y.speak( __( 'Installation completed successfully.' ), 'polite' ); 597 638 598 639 $document.trigger( 'wp-plugin-install-success', response ); … … 602 643 603 644 // Transform the 'Install' button into an 'Activate' button. 604 $message.removeClass( 'install-now installed button-disabled updated-message' ).addClass( 'activate-now button-primary' ) 605 .attr( 'href', response.activateUrl ) 606 .attr( 'aria-label', wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName ) ) 607 .text( wp.updates.l10n.activatePlugin ); 645 $message.removeClass( 'install-now installed button-disabled updated-message' ) 646 .addClass( 'activate-now button-primary' ) 647 .attr( 'href', response.activateUrl ); 648 649 if ( 'plugins-network' === pagenow ) { 650 $message 651 .attr( 652 'aria-label', 653 sprintf( 654 /* translators: %s: Plugin name. */ 655 _x( 'Network Activate %s', 'plugin' ), 656 response.pluginName 657 ) 658 ) 659 .text( __( 'Network Activate' ) ); 660 } else { 661 $message 662 .attr( 663 'aria-label', 664 sprintf( 665 /* translators: %s: Plugin name. */ 666 _x( 'Activate %s', 'plugin' ), 667 response.pluginName 668 ) 669 ) 670 .text( __( 'Activate' ) ); 671 } 608 672 }, 1000 ); 609 673 } … … 634 698 } 635 699 636 errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage ); 700 errorMessage = sprintf( 701 /* translators: %s: Error string for a failed installation. */ 702 __( 'Installation failed: %s' ), 703 response.errorMessage 704 ); 637 705 638 706 $card … … 652 720 $button 653 721 .removeClass( 'updating-message' ).addClass( 'button-disabled' ) 654 .attr( 'aria-label', wp.updates.l10n.pluginInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) 655 .text( wp.updates.l10n.installFailedShort ); 722 .attr( 723 'aria-label', 724 sprintf( 725 /* translators: %s: Plugin name and version. */ 726 _x( '%s installation failed', 'plugin' ), 727 $button.data( 'name' ) 728 ) 729 ) 730 .text( __( 'Installation Failed!' ) ); 656 731 657 732 wp.a11y.speak( errorMessage, 'assertive' ); … … 674 749 id: 'install-success', 675 750 className: 'notice-success is-dismissible', 676 message: wp.updates.l10n.importerInstalledMsg.replace( '%s', response.activateUrl + '&from=import' ) 751 message: sprintf( 752 /* translators: %s: Activation URL. */ 753 __( 'Importer installed successfully. <a href="%s">Run importer</a>' ), 754 response.activateUrl + '&from=import' 755 ) 677 756 } ); 678 757 … … 682 761 .attr({ 683 762 'href': response.activateUrl + '&from=import', 684 'aria-label': wp.updates.l10n.activateImporterLabel.replace( '%s', response.pluginName ) 763 'aria-label':sprintf( 764 /* translators: %s: Importer name. */ 765 __( 'Run %s' ), 766 response.pluginName 767 ) 685 768 }) 686 .text( wp.updates.l10n.activateImporter);687 688 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );769 .text( __( 'Run Importer' ) ); 770 771 wp.a11y.speak( __( 'Installation completed successfully.' ), 'polite' ); 689 772 690 773 $document.trigger( 'wp-importer-install-success', response ); … … 703 786 */ 704 787 wp.updates.installImporterError = function( response ) { 705 var errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage ), 788 var errorMessage = sprintf( 789 /* translators: %s: Error string for a failed installation. */ 790 __( 'Installation failed: %s' ), 791 response.errorMessage 792 ), 706 793 $installLink = $( '[data-slug="' + response.slug + '"]' ), 707 794 pluginName = $installLink.data( 'name' ); … … 723 810 $installLink 724 811 .removeClass( 'updating-message' ) 725 .text( wp.updates.l10n.installNow ) 726 .attr( 'aria-label', wp.updates.l10n.pluginInstallNowLabel.replace( '%s', pluginName ) ); 812 .attr( 813 'aria-label', 814 sprintf( 815 /* translators: %s: Plugin name. */ 816 _x( 'Install %s now', 'plugin' ), 817 pluginName 818 ) 819 ) 820 .text( __( 'Install Now' ) ); 727 821 728 822 wp.a11y.speak( errorMessage, 'assertive' ); … … 752 846 }, args ); 753 847 754 if ( $link.html() !== wp.updates.l10n.deleting) {848 if ( $link.html() !== __( 'Deleting...' ) ) { 755 849 $link 756 850 .data( 'originaltext', $link.html() ) 757 .text( wp.updates.l10n.deleting);758 } 759 760 wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );851 .text( __( 'Deleting...' ) ); 852 } 853 854 wp.a11y.speak( __( 'Deleting...' ), 'polite' ); 761 855 762 856 $document.trigger( 'wp-plugin-deleting', args ); … … 848 942 849 943 if ( ! $form.find( 'tr.no-items' ).length ) { 850 $form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + wp.updates.l10n.noPlugins+ '</td></tr>' );944 $form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + __( 'You do not appear to have any plugins available at this time.' ) + '</td></tr>' ); 851 945 } 852 946 } 853 947 } ); 854 948 855 wp.a11y.speak( wp.updates.l10n.pluginDeleted, 'polite' );949 wp.a11y.speak( _x( 'Deleted!', 'plugin' ), 'polite' ); 856 950 857 951 $document.trigger( 'wp-plugin-delete-success', response ); … … 958 1052 } 959 1053 960 if ( $notice.html() !== wp.updates.l10n.updating) {1054 if ( $notice.html() !== __( 'Updating...' ) ) { 961 1055 $notice.data( 'originaltext', $notice.html() ); 962 1056 } 963 1057 964 wp.a11y.speak( wp.updates.l10n.updatingMsg, 'polite' );965 $notice.text( wp.updates.l10n.updating);1058 wp.a11y.speak( __( 'Updating... please wait.' ), 'polite' ); 1059 $notice.text( __( 'Updating...' ) ); 966 1060 967 1061 $document.trigger( 'wp-theme-updating', args ); … … 987 1081 updatedMessage = { 988 1082 className: 'updated-message notice-success notice-alt', 989 message: wp.updates.l10n.themeUpdated1083 message: _x( 'Updated!', 'theme' ) 990 1084 }, 991 1085 $notice, newText; … … 1024 1118 1025 1119 wp.updates.addAdminNotice( _.extend( { selector: $notice }, updatedMessage ) ); 1026 wp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );1120 wp.a11y.speak( __( 'Update completed successfully.' ), 'polite' ); 1027 1121 1028 1122 wp.updates.decrementCount( 'theme' ); … … 1048 1142 wp.updates.updateThemeError = function( response ) { 1049 1143 var $theme = $( '[data-slug="' + response.slug + '"]' ), 1050 errorMessage = wp.updates.l10n.updateFailed.replace( '%s', response.errorMessage ), 1144 errorMessage = sprintf( 1145 /* translators: %s: Error string for a failed update. */ 1146 __( 'Update Failed: %s' ), 1147 response.errorMessage 1148 ), 1051 1149 $notice; 1052 1150 … … 1104 1202 $message.addClass( 'updating-message' ); 1105 1203 $message.parents( '.theme' ).addClass( 'focus' ); 1106 if ( $message.html() !== wp.updates.l10n.installing) {1204 if ( $message.html() !== __( 'Installing...' ) ) { 1107 1205 $message.data( 'originaltext', $message.html() ); 1108 1206 } 1109 1207 1110 1208 $message 1111 .text( wp.updates.l10n.installing ) 1112 .attr( 'aria-label', wp.updates.l10n.themeInstallingLabel.replace( '%s', $message.data( 'name' ) ) ); 1113 wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' ); 1209 .attr( 1210 'aria-label', 1211 sprintf( 1212 /* translators: %s: Theme name and version. */ 1213 _x( 'Installing %s...', 'theme' ), 1214 $message.data( 'name' ) 1215 ) 1216 ) 1217 .text( __( 'Installing...' ) ); 1218 1219 wp.a11y.speak( __( 'Installing... please wait.' ), 'polite' ); 1114 1220 1115 1221 // Remove previous error messages, if any. … … 1140 1246 .removeClass( 'updating-message' ) 1141 1247 .addClass( 'updated-message disabled' ) 1142 .attr( 'aria-label', wp.updates.l10n.themeInstalledLabel.replace( '%s', response.themeName ) ) 1143 .text( wp.updates.l10n.themeInstalled ); 1144 1145 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); 1248 .attr( 1249 'aria-label', 1250 sprintf( 1251 /* translators: %s: Theme name and version. */ 1252 _x( '%s installed!', 'theme' ), 1253 response.themeName 1254 ) 1255 ) 1256 .text( _x( 'Installed!', 'theme' ) ); 1257 1258 wp.a11y.speak( __( 'Installation completed successfully.' ), 'polite' ); 1146 1259 1147 1260 setTimeout( function() { … … 1153 1266 .attr( 'href', response.activateUrl ) 1154 1267 .removeClass( 'theme-install updated-message disabled' ) 1155 .addClass( 'activate' ) 1156 .attr( 'aria-label', wp.updates.l10n.activateThemeLabel.replace( '%s', response.themeName ) ) 1157 .text( wp.updates.l10n.activateTheme ); 1268 .addClass( 'activate' ); 1269 1270 if ( 'themes-network' === pagenow ) { 1271 $message 1272 .attr( 1273 'aria-label', 1274 sprintf( 1275 /* translators: %s: Theme name. */ 1276 _x( 'Network Activate %s', 'theme' ), 1277 response.themeName 1278 ) 1279 ) 1280 .text( __( 'Network Enable' ) ); 1281 } else { 1282 $message 1283 .attr( 1284 'aria-label', 1285 sprintf( 1286 /* translators: %s: Theme name. */ 1287 _x( 'Activate %s', 'theme' ), 1288 response.themeName 1289 ) 1290 ) 1291 .text( __( 'Activate' ) ); 1292 } 1158 1293 } 1159 1294 … … 1165 1300 .attr( 'href', response.customizeUrl ) 1166 1301 .addClass( 'button load-customize' ) 1167 .text( wp.updates.l10n.livePreview);1302 .text( __( 'Live Preview' ) ); 1168 1303 } ); 1169 1304 } … … 1183 1318 wp.updates.installThemeError = function( response ) { 1184 1319 var $card, $button, 1185 errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage ), 1320 errorMessage = sprintf( 1321 /* translators: %s: Error string for a failed installation. */ 1322 __( 'Installation failed: %s' ), 1323 response.errorMessage 1324 ), 1186 1325 $message = wp.updates.adminNotice( { 1187 1326 className: 'update-message notice-error notice-alt', … … 1218 1357 $button 1219 1358 .removeClass( 'updating-message' ) 1220 .attr( 'aria-label', wp.updates.l10n.themeInstallFailedLabel.replace( '%s', $button.data( 'name' ) ) ) 1221 .text( wp.updates.l10n.installFailedShort ); 1359 .attr( 1360 'aria-label', 1361 sprintf( 1362 /* translators: %s: Theme name and version. */ 1363 _x( '%s installation failed', 'theme' ), 1364 $button.data( 'name' ) 1365 ) 1366 ) 1367 .text( __( 'Installation Failed!' ) ); 1222 1368 1223 1369 wp.a11y.speak( errorMessage, 'assertive' ); … … 1252 1398 }, args ); 1253 1399 1254 if ( $button && $button.html() !== wp.updates.l10n.deleting) {1400 if ( $button && $button.html() !== __( 'Deleting...' ) ) { 1255 1401 $button 1256 1402 .data( 'originaltext', $button.html() ) 1257 .text( wp.updates.l10n.deleting);1258 } 1259 1260 wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );1403 .text( __( 'Deleting...' ) ); 1404 } 1405 1406 wp.a11y.speak( __( 'Deleting...' ), 'polite' ); 1261 1407 1262 1408 // Remove previous error messages, if any. … … 1321 1467 } 1322 1468 1323 wp.a11y.speak( wp.updates.l10n.themeDeleted, 'polite' );1469 wp.a11y.speak( _x( 'Deleted!', 'theme' ), 'polite' ); 1324 1470 1325 1471 $document.trigger( 'wp-theme-delete-success', response ); … … 1341 1487 updateRow = wp.template( 'item-update-row' ), 1342 1488 $updateRow = $themeRow.siblings( '#' + response.slug + '-update' ), 1343 errorMessage = wp.updates.l10n.deleteFailed.replace( '%s', response.errorMessage ), 1489 errorMessage = sprintf( 1490 /* translators: %s: Error string for a failed deletion. */ 1491 __( 'Deletion failed: %s' ), 1492 response.errorMessage 1493 ), 1344 1494 $message = wp.updates.adminNotice( { 1345 1495 className: 'update-message notice-error notice-alt', … … 1632 1782 */ 1633 1783 wp.updates.isValidResponse = function( response, action ) { 1634 var error = wp.updates.l10n.unknownError,1635 1784 var error = __( 'Something went wrong.' ), 1785 errorMessage; 1636 1786 1637 1787 // Make sure the response is a valid data object and not a Promise object. … … 1641 1791 1642 1792 if ( _.isString( response ) && '-1' === response ) { 1643 error = wp.updates.l10n.nonceError;1793 error = __( 'An error has occurred. Please reload the page and try again.' ); 1644 1794 } else if ( _.isString( response ) ) { 1645 1795 error = response; 1646 1796 } else if ( 'undefined' !== typeof response.readyState && 0 === response.readyState ) { 1647 error = wp.updates.l10n.connectionError;1797 error = __( 'Connection lost or the server is busy. Please try again later.' ); 1648 1798 } else if ( _.isString( response.responseText ) && '' !== response.responseText ) { 1649 1799 error = response.responseText; … … 1654 1804 switch ( action ) { 1655 1805 case 'update': 1656 errorMessage = wp.updates.l10n.updateFailed; 1806 /* translators: %s: Error string for a failed update. */ 1807 errorMessage = __( 'Update Failed: %s' ); 1657 1808 break; 1658 1809 1659 1810 case 'install': 1660 errorMessage = wp.updates.l10n.installFailed; 1811 /* translators: %s: Error string for a failed installation. */ 1812 errorMessage = __( 'Installation failed: %s' ); 1661 1813 break; 1662 1814 1663 1815 case 'delete': 1664 errorMessage = wp.updates.l10n.deleteFailed; 1816 /* translators: %s: Error string for a failed deletion. */ 1817 errorMessage = __( 'Deletion failed: %s' ); 1665 1818 break; 1666 1819 } … … 1686 1839 .removeAttr( 'aria-label' ) 1687 1840 .prop( 'disabled', true ) 1688 .text( wp.updates.l10n.updateFailedShort);1841 .text( __( 'Update Failed!' ) ); 1689 1842 1690 1843 $( '.updating-message:not(.button):not(.thickbox)' ) … … 1710 1863 wp.updates.beforeunload = function() { 1711 1864 if ( wp.updates.ajaxLocked ) { 1712 return wp.updates.l10n.beforeunload;1865 return __( 'Updates may not complete if you navigate away from this page.' ); 1713 1866 } 1714 1867 }; … … 1823 1976 if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) { 1824 1977 if ( 'update-plugin' === job.action ) { 1825 $message.attr( 'aria-label', wp.updates.l10n.pluginUpdateNowLabel.replace( '%s', $message.data( 'name' ) ) ); 1978 $message.attr( 1979 'aria-label', 1980 sprintf( 1981 /* translators: %s: Plugin name and version. */ 1982 _x( 'Update %s now', 'plugin' ), 1983 $message.data( 'name' ) 1984 ) 1985 ); 1826 1986 } else if ( 'install-plugin' === job.action ) { 1827 $message.attr( 'aria-label', wp.updates.l10n.pluginInstallNowLabel.replace( '%s', $message.data( 'name' ) ) ); 1987 $message.attr( 1988 'aria-label', 1989 sprintf( 1990 /* translators: %s: Plugin name. */ 1991 _x( 'Install %s now', 'plugin' ), 1992 $message.data( 'name' ) 1993 ) 1994 ); 1828 1995 } 1829 1996 } 1830 1997 } 1831 1998 1832 wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );1999 wp.a11y.speak( __( 'Update canceled.' ), 'polite' ); 1833 2000 } ); 1834 2001 … … 1906 2073 $message 1907 2074 .removeClass( 'updating-message' ) 1908 .text( wp.updates.l10n.installNow);1909 1910 wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );2075 .text( __( 'Install Now' ) ); 2076 2077 wp.a11y.speak( __( 'Update canceled.' ), 'polite' ); 1911 2078 } ); 1912 2079 } … … 1941 2108 $button 1942 2109 .removeClass( 'updating-message' ) 1943 .text( wp.updates.l10n.installNow ) 1944 .attr( 'aria-label', wp.updates.l10n.pluginInstallNowLabel.replace( '%s', pluginName ) ); 1945 1946 wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' ); 2110 .attr( 2111 'aria-label', 2112 sprintf( 2113 /* translators: %s: Plugin name. */ 2114 _x( 'Install %s now', 'plugin' ), 2115 pluginName 2116 ) 2117 ) 2118 .text( __( 'Install Now' ) ); 2119 2120 wp.a11y.speak( __( 'Update canceled.' ), 'polite' ); 1947 2121 } ); 1948 2122 } … … 1964 2138 */ 1965 2139 $bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) { 1966 var $pluginRow = $( event.target ).parents( 'tr' ); 2140 var $pluginRow = $( event.target ).parents( 'tr' ), 2141 confirmMessage = sprintf( 2142 /* translators: %s: Plugin name. */ 2143 __( 'Are you sure you want to delete %s and its data?' ), 2144 $pluginRow.find( '.plugin-title strong' ).text() 2145 ); 1967 2146 1968 2147 event.preventDefault(); 1969 2148 1970 if ( ! window.confirm( wp.updates.l10n.aysDeleteUninstall.replace( '%s', $pluginRow.find( '.plugin-title strong' ).text() )) ) {2149 if ( ! window.confirm( confirmMessage ) ) { 1971 2150 return; 1972 2151 } … … 2015 2194 */ 2016 2195 $document.on( 'click', '.themes-php.network-admin a.delete', function( event ) { 2017 var $themeRow = $( event.target ).parents( 'tr' ); 2196 var $themeRow = $( event.target ).parents( 'tr' ), 2197 confirmMessage = sprintf( 2198 /* translators: %s: Theme name. */ 2199 __( 'Are you sure you want to delete %s?' ), 2200 $themeRow.find( '.theme-title strong' ).text() 2201 ); 2018 2202 2019 2203 event.preventDefault(); 2020 2204 2021 if ( ! window.confirm( wp.updates.l10n.aysDelete.replace( '%s', $themeRow.find( '.theme-title strong' ).text() )) ) {2205 if ( ! window.confirm( confirmMessage ) ) { 2022 2206 return; 2023 2207 } … … 2070 2254 id: 'no-items-selected', 2071 2255 className: 'notice-error is-dismissible', 2072 message: wp.updates.l10n.noItemsSelected2256 message: __( 'Please select at least one item to perform this action on.' ) 2073 2257 } ); 2074 2258 } … … 2081 2265 2082 2266 case 'delete-selected': 2083 if ( ! window.confirm( 'plugin' === type ? wp.updates.l10n.aysBulkDelete : wp.updates.l10n.aysBulkDeleteThemes ) ) { 2267 var confirmMessage = 'plugin' === type ? 2268 __( 'Are you sure you want to delete the selected plugins and their data?' ) : 2269 __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ); 2270 2271 if ( ! window.confirm( confirmMessage ) ) { 2084 2272 event.preventDefault(); 2085 2273 return; … … 2218 2406 'class': 'current', 2219 2407 'href': searchLocation, 2220 'text': wp.updates.l10n.searchResultsLabel2408 'text': __( 'Search Results' ) 2221 2409 } ) ); 2222 2410 … … 2241 2429 2242 2430 if ( 0 === response.count ) { 2243 wp.a11y.speak( wp.updates.l10n.noPluginsFound);2431 wp.a11y.speak( __( 'You do not appear to have any plugins available at this time.' ) ); 2244 2432 } else { 2245 wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) ); 2433 wp.a11y.speak( 2434 sprintf( 2435 /* translators: %s: Number of plugins. */ 2436 __( 'Number of plugins found: %d' ), 2437 response.count 2438 ) 2439 ); 2246 2440 } 2247 2441 } ); … … 2299 2493 2300 2494 // Can we just ditch this whole subtitle business? 2301 var $subTitle = $( '<span />' ).addClass( 'subtitle' ).html( wp.updates.l10n.searchResults.replace( '%s', _.escape( data.s ) ) ), 2495 var $subTitle = $( '<span />' ).addClass( 'subtitle' ).html( 2496 sprintf( 2497 /* translators: %s: Search query. */ 2498 __( 'Search results for “%s”' ), 2499 _.escape( data.s ) 2500 ) ), 2302 2501 $oldSubTitle = $( '.wrap .subtitle' ); 2303 2502 … … 2316 2515 2317 2516 if ( 0 === response.count ) { 2318 wp.a11y.speak( wp.updates.l10n.noPluginsFound);2517 wp.a11y.speak( __( 'No plugins found. Try a different search.' ) ); 2319 2518 } else { 2320 wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) ); 2519 wp.a11y.speak( 2520 sprintf( 2521 /* translators: %s: Number of plugins. */ 2522 __( 'Number of plugins found: %d' ), 2523 response.count 2524 ) 2525 ); 2321 2526 } 2322 2527 } ); … … 2519 2724 // Show loading status. 2520 2725 if ( 'enable' === action ) { 2521 $label.text( wp.updates.l10n.autoUpdatesEnabling);2726 $label.text( __( 'Enabling...' ) ); 2522 2727 } else { 2523 $label.text( wp.updates.l10n.autoUpdatesDisabling);2728 $label.text( __( 'Disabling...' ) ); 2524 2729 } 2525 2730 … … 2545 2750 errorMessage = response.data.error; 2546 2751 } else { 2547 errorMessage = wp.updates.l10n.autoUpdatesError;2752 errorMessage = __( 'The request could not be completed.' ); 2548 2753 } 2549 2754 … … 2586 2791 } ); 2587 2792 2588 $label.text( wp.updates.l10n.autoUpdatesDisable);2793 $label.text( __( 'Disable auto-updates' ) ); 2589 2794 $parent.find( '.auto-update-time' ).removeClass( 'hidden' ); 2590 wp.a11y.speak( wp.updates.l10n.autoUpdatesEnabled, 'polite' );2795 wp.a11y.speak( __( 'Enable auto-updates' ), 'polite' ); 2591 2796 } else { 2592 2797 href = href.replace( 'action=disable-auto-update', 'action=enable-auto-update' ); … … 2596 2801 } ); 2597 2802 2598 $label.text( wp.updates.l10n.autoUpdatesEnable);2803 $label.text( __( 'Enable auto-updates' ) ); 2599 2804 $parent.find( '.auto-update-time' ).addClass( 'hidden' ); 2600 wp.a11y.speak( wp.updates.l10n.autoUpdatesDisabled, 'polite' );2805 wp.a11y.speak( __( 'Auto-updates disabled' ), 'polite' ); 2601 2806 } 2602 2807 … … 2604 2809 } ) 2605 2810 .fail( function() { 2606 $parent.find( '.notice.error' ).removeClass( 'hidden' ).find( 'p' ).text( wp.updates.l10n.autoUpdatesError ); 2607 wp.a11y.speak( wp.updates.l10n.autoUpdatesError, 'polite' ); 2811 $parent.find( '.notice.error' ) 2812 .removeClass( 'hidden' ) 2813 .find( 'p' ) 2814 .text( __( 'The request could not be completed.' ) ); 2815 2816 wp.a11y.speak( __( 'The request could not be completed.' ), 'polite' ); 2608 2817 } ) 2609 2818 .always( function() { -
trunk/src/wp-includes/script-loader.php
r47835 r47884 1435 1435 1436 1436 $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 ); 1437 $scripts->set_translations( 'updates' ); 1437 1438 did_action( 'init' ) && $scripts->localize( 1438 1439 'updates', … … 1440 1441 array( 1441 1442 'ajax_nonce' => wp_create_nonce( 'updates' ), 1442 'l10n' => array(1443 /* translators: %s: Search query. */1444 'searchResults' => __( 'Search results for “%s”' ),1445 'searchResultsLabel' => __( 'Search Results' ),1446 'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ),1447 'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ),1448 'updating' => __( 'Updating...' ), // No ellipsis.1449 'pluginUpdated' => _x( 'Updated!', 'plugin' ),1450 'themeUpdated' => _x( 'Updated!', 'theme' ),1451 'update' => __( 'Update' ),1452 'updateNow' => __( 'Update Now' ),1453 /* translators: %s: Plugin name and version. */1454 'pluginUpdateNowLabel' => _x( 'Update %s now', 'plugin' ),1455 'updateFailedShort' => __( 'Update Failed!' ),1456 /* translators: %s: Error string for a failed update. */1457 'updateFailed' => __( 'Update Failed: %s' ),1458 /* translators: %s: Plugin name and version. */1459 'pluginUpdatingLabel' => _x( 'Updating %s...', 'plugin' ), // No ellipsis.1460 /* translators: %s: Plugin name and version. */1461 'pluginUpdatedLabel' => _x( '%s updated!', 'plugin' ),1462 /* translators: %s: Plugin name and version. */1463 'pluginUpdateFailedLabel' => _x( '%s update failed', 'plugin' ),1464 /* translators: Accessibility text. */1465 'updatingMsg' => __( 'Updating... please wait.' ), // No ellipsis.1466 /* translators: Accessibility text. */1467 'updatedMsg' => __( 'Update completed successfully.' ),1468 /* translators: Accessibility text. */1469 'updateCancel' => __( 'Update canceled.' ),1470 'beforeunload' => __( 'Updates may not complete if you navigate away from this page.' ),1471 'installNow' => __( 'Install Now' ),1472 /* translators: %s: Plugin name. */1473 'pluginInstallNowLabel' => _x( 'Install %s now', 'plugin' ),1474 'installing' => __( 'Installing...' ),1475 'pluginInstalled' => _x( 'Installed!', 'plugin' ),1476 'themeInstalled' => _x( 'Installed!', 'theme' ),1477 'installFailedShort' => __( 'Installation Failed!' ),1478 /* translators: %s: Error string for a failed installation. */1479 'installFailed' => __( 'Installation failed: %s' ),1480 /* translators: %s: Plugin name and version. */1481 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // No ellipsis.1482 /* translators: %s: Theme name and version. */1483 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // No ellipsis.1484 /* translators: %s: Plugin name and version. */1485 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ),1486 /* translators: %s: Theme name and version. */1487 'themeInstalledLabel' => _x( '%s installed!', 'theme' ),1488 /* translators: %s: Plugin name and version. */1489 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),1490 /* translators: %s: Theme name and version. */1491 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ),1492 'installingMsg' => __( 'Installing... please wait.' ),1493 'installedMsg' => __( 'Installation completed successfully.' ),1494 /* translators: %s: Activation URL. */1495 'importerInstalledMsg' => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),1496 /* translators: %s: Theme name. */1497 'aysDelete' => __( 'Are you sure you want to delete %s?' ),1498 /* translators: %s: Plugin name. */1499 'aysDeleteUninstall' => __( 'Are you sure you want to delete %s and its data?' ),1500 'aysBulkDelete' => __( 'Are you sure you want to delete the selected plugins and their data?' ),1501 'aysBulkDeleteThemes' => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),1502 'deleting' => __( 'Deleting...' ),1503 /* translators: %s: Error string for a failed deletion. */1504 'deleteFailed' => __( 'Deletion failed: %s' ),1505 'pluginDeleted' => _x( 'Deleted!', 'plugin' ),1506 'themeDeleted' => _x( 'Deleted!', 'theme' ),1507 'livePreview' => __( 'Live Preview' ),1508 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),1509 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),1510 /* translators: %s: Plugin name. */1511 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),1512 /* translators: %s: Theme name. */1513 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),1514 'activateImporter' => __( 'Run Importer' ),1515 /* translators: %s: Importer name. */1516 'activateImporterLabel' => __( 'Run %s' ),1517 'unknownError' => __( 'Something went wrong.' ),1518 'connectionError' => __( 'Connection lost or the server is busy. Please try again later.' ),1519 'nonceError' => __( 'An error has occurred. Please reload the page and try again.' ),1520 /* translators: %s: Number of plugins. */1521 'pluginsFound' => __( 'Number of plugins found: %d' ),1522 'noPluginsFound' => __( 'No plugins found. Try a different search.' ),1523 'autoUpdatesEnable' => __( 'Enable auto-updates' ),1524 'autoUpdatesEnabling' => __( 'Enabling...' ),1525 'autoUpdatesEnabled' => __( 'Auto-updates enabled' ),1526 'autoUpdatesDisable' => __( 'Disable auto-updates' ),1527 'autoUpdatesDisabling' => __( 'Disabling...' ),1528 'autoUpdatesDisabled' => __( 'Auto-updates disabled' ),1529 'autoUpdatesError' => __( 'The request could not be completed.' ),1530 ),1531 1443 ) 1532 1444 );
Note: See TracChangeset
for help on using the changeset viewer.