Ticket #51498: 51498.2.patch
| File 51498.2.patch, 14.2 KB (added by , 6 years ago) |
|---|
-
src/js/_enqueues/admin/common.js
55 55 * Deprecate all properties on an object. 56 56 * 57 57 * @since 5.5.1 58 * @since 5.6.0 Added the `version` parameter. 58 59 * 59 60 * @param {string} name The name of the object, i.e. commonL10n. 60 61 * @param {object} l10nObject The object to deprecate the properties on. 62 * @param {string} version The version of WordPress that deprecated the property. 61 63 * 62 64 * @return {object} The object with all its properties deprecated. 63 65 */ 64 function deprecateL10nObject( name, l10nObject ) {66 function deprecateL10nObject( name, l10nObject, version ) { 65 67 var deprecatedObject = {}; 66 68 67 69 Object.keys( l10nObject ).forEach( function( key ) { … … 70 72 71 73 if ( 'object' === typeof prop ) { 72 74 Object.defineProperty( deprecatedObject, key, { get: function() { 73 deprecatedProperty( propName, '5.5.0', prop.alternative );75 deprecatedProperty( propName, version, prop.alternative ); 74 76 return prop.func(); 75 77 } } ); 76 78 } else { 77 79 Object.defineProperty( deprecatedObject, key, { get: function() { 78 deprecatedProperty( propName, '5.5.0', 'wp.i18n' );80 deprecatedProperty( propName, version, 'wp.i18n' ); 79 81 return prop; 80 82 } } ); 81 83 } … … 99 101 expandMenu: '' 100 102 }; 101 103 102 window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n );104 window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n, '5.5.0' ); 103 105 104 106 /** 105 107 * Removed in 5.5.0, needed for back-compatibility. … … 111 113 dismiss: '' 112 114 }; 113 115 114 window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n );116 window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n, '5.5.0' ); 115 117 116 118 /** 117 119 * Removed in 5.5.0, needed for back-compatibility. … … 129 131 ariaHide: '' 130 132 }; 131 133 132 window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n );134 window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n, '5.5.0' ); 133 135 134 136 /** 135 137 * Removed in 5.5.0, needed for back-compatibility. … … 148 150 exportError: '' 149 151 }; 150 152 151 window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n );153 window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n, '5.5.0' ); 152 154 153 155 /** 154 156 * Removed in 5.5.0, needed for back-compatibility. … … 160 162 beforeunload: '' 161 163 }; 162 164 163 window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n );165 window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n, '5.5.0' ); 164 166 165 167 /** 166 168 * Removed in 5.5.0, needed for back-compatibility. … … 173 175 broken: '' 174 176 }; 175 177 176 window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n );178 window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n, '5.5.0' ); 177 179 178 180 /** 179 181 * Removed in 5.5.0, needed for back-compatibility. … … 198 200 docTitleCommentsCount: '' 199 201 }; 200 202 201 window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n );203 window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n, '5.5.0' ); 202 204 203 205 /** 204 206 * Removed in 5.5.0, needed for back-compatibility. … … 214 216 termRemoved: '' 215 217 }; 216 218 217 window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n );219 window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n, '5.5.0' ); 218 220 219 221 /** 220 222 * Removed in 5.5.0, needed for back-compatibility. … … 231 233 defaultLabel: '' 232 234 }; 233 235 234 window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n );236 window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n, '5.5.0' ); 235 237 236 238 /** 237 239 * Removed in 5.5.0, needed for back-compatibility. … … 243 245 error: '' 244 246 }; 245 247 246 window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n );248 window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n, '5.5.0' ); 247 249 248 250 /** 249 251 * Removed in 5.5.0, needed for back-compatibility. … … 276 278 permalinkSaved: '' 277 279 }; 278 280 279 window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n );281 window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n, '5.5.0' ); 280 282 281 283 /** 282 284 * Removed in 5.5.0, needed for back-compatibility. … … 292 294 saved: '' 293 295 }; 294 296 295 window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n );297 window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n, '5.5.0' ); 296 298 297 299 /** 298 300 * Removed in 5.5.0, needed for back-compatibility. … … 306 308 ays: '' 307 309 }; 308 310 309 window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n );311 window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n, '5.5.0' ); 310 312 311 313 /** 312 314 * Removed in 5.5.0, needed for back-compatibility. … … 321 323 untitled: '' 322 324 }; 323 325 324 window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n );326 window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n, '5.5.0' ); 325 327 326 328 /** 327 329 * Removed in 5.5.0, needed for back-compatibility. … … 334 336 dateFormat: '' 335 337 }; 336 338 337 window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n );339 window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n, '5.5.0' ); 338 340 339 341 /** 340 342 * Removed in 5.5.0, needed for back-compatibility. … … 349 351 done: '' 350 352 }; 351 353 352 window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n );354 window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' ); 353 355 354 356 /** 355 357 * Removed in 3.3.0, needed for back-compatibility. -
src/js/_enqueues/admin/widgets.js
760 760 widgetAdded: '' 761 761 }; 762 762 763 wpWidgets.l10n = window.wp.deprecateL10nObject( 'wpWidgets.l10n', wpWidgets.l10n );763 wpWidgets.l10n = window.wp.deprecateL10nObject( 'wpWidgets.l10n', wpWidgets.l10n, '5.5.0' ); -
src/js/_enqueues/wp/dashboard.js
5 5 /* global pagenow, ajaxurl, postboxes, wpActiveEditor:true, ajaxWidgets */ 6 6 /* global ajaxPopulateWidgets, quickPressLoad, */ 7 7 window.wp = window.wp || {}; 8 window.communityEventsData = window.communityEventsData || {}; 8 9 9 10 /** 10 11 * Initializes the dashboard widget functionality. … … 265 266 jQuery( function( $ ) { 266 267 'use strict'; 267 268 268 var communityEventsData = window.communityEventsData || {}, 269 var communityEventsData = window.communityEventsData, 270 sprintf = wp.i18n.sprintf, 271 __ = wp.i18n.__, 269 272 dateI18n = wp.date.dateI18n, 270 273 format = wp.date.format, 271 274 sprintf = wp.i18n.sprintf, … … 466 469 renderEventsTemplate: function( templateParams, initiatedBy ) { 467 470 var template, 468 471 elementVisibility, 469 l10nPlaceholder = /%(?:\d\$)?s/g, // Match `%s`, `%1$s`, `%2$s`, etc.470 472 $toggleButton = $( '.community-events-toggle-location' ), 471 473 $locationMessage = $( '#community-events-location-message' ), 472 474 $results = $( '.community-events-results' ); … … 505 507 * If the API determined the location by geolocating an IP, it will 506 508 * provide events, but not a specific location. 507 509 */ 508 $locationMessage.text( communityEventsData.l10n.attend_event_near_generic);510 $locationMessage.text( __( 'Attend an upcoming event near you.' ) ); 509 511 510 512 if ( templateParams.events.length ) { 511 513 template = wp.template( 'community-events-event-list' ); … … 532 534 } 533 535 534 536 if ( 'user' === initiatedBy ) { 535 wp.a11y.speak( communityEventsData.l10n.city_updated.replace( l10nPlaceholder, templateParams.location.description ), 'assertive' ); 537 wp.a11y.speak( 538 sprintf( 539 /* translators: %s: The name of a city. */ 540 __( 'City updated. Listing events near %s.' ), 541 templateParams.location.description 542 ), 543 'assertive' 544 ); 536 545 } 537 546 538 547 elementVisibility['#community-events-location-message'] = true; … … 542 551 } else if ( templateParams.unknownCity ) { 543 552 template = wp.template( 'community-events-could-not-locate' ); 544 553 $( '.community-events-could-not-locate' ).html( template( templateParams ) ); 545 wp.a11y.speak( communityEventsData.l10n.could_not_locate_city.replace( l10nPlaceholder, templateParams.unknownCity ) ); 554 wp.a11y.speak( 555 sprintf( 556 /* 557 * These specific examples were chosen to highlight the fact that a 558 * state is not needed, even for cities whose name is not unique. 559 * It would be too cumbersome to include that in the instructions 560 * to the user, so it's left as an implication. 561 */ 562 /* 563 * translators: %s is the name of the city we couldn't locate. 564 * Replace the examples with cities related to your locale. Test that 565 * they match the expected location and have upcoming events before 566 * including them. If no cities related to your locale have events, 567 * then use cities related to your locale that would be recognizable 568 * to most users. Use only the city name itself, without any region 569 * or country. Use the endonym (native locale name) instead of the 570 * English name if possible. 571 */ 572 __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), 573 templateParams.unknownCity 574 ) 575 ); 546 576 547 577 elementVisibility['.community-events-errors'] = true; 548 578 elementVisibility['.community-events-could-not-locate'] = true; … … 554 584 * Showing error messages for an event that user isn't aware of 555 585 * could be confusing or unnecessarily distracting. 556 586 */ 557 wp.a11y.speak( communityEventsData.l10n.error_occurred_please_try_again);587 wp.a11y.speak( __( 'An error occurred. Please try again.' ) ); 558 588 559 589 elementVisibility['.community-events-errors'] = true; 560 590 elementVisibility['.community-events-error-occurred'] = true; 561 591 } else { 562 $locationMessage.text( communityEventsData.l10n.enter_closest_city);592 $locationMessage.text( __( 'Enter your closest city to find nearby events.' ) ); 563 593 564 594 elementVisibility['#community-events-location-message'] = true; 565 595 elementVisibility['.community-events-toggle-location'] = true; … … 791 821 }); 792 822 } 793 823 }); 824 825 /** 826 * Removed in 5.6.0, needed for back-compatibility. 827 * 828 * @since 4.8.0 829 * @deprecated 5.6.0 830 * 831 * @type {object} 832 */ 833 window.communityEventsData.l10n = window.communityEventsData.l10n || { 834 enter_closest_city: '', 835 error_occurred_please_try_again: '', 836 attend_event_near_generic: '', 837 could_not_locate_city: '', 838 city_updated: '' 839 }; 840 841 window.communityEventsData.l10n = window.wp.deprecateL10nObject( 'communityEventsData.l10n', window.communityEventsData.l10n, '5.6.0' ); -
src/js/_enqueues/wp/theme-plugin-editor.js
1023 1023 } 1024 1024 }; 1025 1025 1026 wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n );1026 wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n, '5.5.0' ); -
src/js/_enqueues/wp/updates.js
115 115 autoUpdatesError: '' 116 116 }; 117 117 118 wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n );118 wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n, '5.5.0' ); 119 119 120 120 /** 121 121 * User nonce for ajax calls. -
src/wp-includes/script-loader.php
1757 1757 'nonce' => wp_create_nonce( 'community_events' ), 1758 1758 'cache' => $events_client->get_cached_events(), 1759 1759 'time_format' => get_option( 'time_format' ), 1760 1761 'l10n' => array(1762 'enter_closest_city' => __( 'Enter your closest city to find nearby events.' ),1763 'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),1764 'attend_event_near_generic' => __( 'Attend an upcoming event near you.' ),1765 1766 /*1767 * These specific examples were chosen to highlight the fact that a1768 * state is not needed, even for cities whose name is not unique.1769 * It would be too cumbersome to include that in the instructions1770 * to the user, so it's left as an implication.1771 */1772 /*1773 * translators: %s is the name of the city we couldn't locate.1774 * Replace the examples with cities related to your locale. Test that1775 * they match the expected location and have upcoming events before1776 * including them. If no cities related to your locale have events,1777 * then use cities related to your locale that would be recognizable1778 * to most users. Use only the city name itself, without any region1779 * or country. Use the endonym (native locale name) instead of the1780 * English name if possible.1781 */1782 'could_not_locate_city' => __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),1783 1784 // This one is only used with wp.a11y.speak(), so it can/should be more brief.1785 /* translators: %s: The name of a city. */1786 'city_updated' => __( 'City updated. Listing events near %s.' ),1787 ),1788 1760 ) 1789 1761 ); 1790 1762 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)