Changeset 49151
- Timestamp:
- 10/14/2020 09:11:09 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/common.js
r49142 r49151 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 … … 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 } } ); … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** … … 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 /** -
trunk/src/js/_enqueues/admin/widgets.js
r48923 r49151 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' ); -
trunk/src/js/_enqueues/wp/dashboard.js
r49146 r49151 6 6 /* global ajaxPopulateWidgets, quickPressLoad, */ 7 7 window.wp = window.wp || {}; 8 window.communityEventsData = window.communityEventsData || {}; 8 9 9 10 /** … … 266 267 'use strict'; 267 268 268 var communityEventsData = window.communityEventsData || {},269 var communityEventsData = window.communityEventsData, 269 270 dateI18n = wp.date.dateI18n, 270 271 format = wp.date.format, … … 467 468 var template, 468 469 elementVisibility, 469 l10nPlaceholder = /%(?:\d\$)?s/g, // Match `%s`, `%1$s`, `%2$s`, etc.470 470 $toggleButton = $( '.community-events-toggle-location' ), 471 471 $locationMessage = $( '#community-events-location-message' ), … … 506 506 * provide events, but not a specific location. 507 507 */ 508 $locationMessage.text( communityEventsData.l10n.attend_event_near_generic);508 $locationMessage.text( __( 'Attend an upcoming event near you.' ) ); 509 509 510 510 if ( templateParams.events.length ) { … … 533 533 534 534 if ( 'user' === initiatedBy ) { 535 wp.a11y.speak( communityEventsData.l10n.city_updated.replace( l10nPlaceholder, templateParams.location.description ), 'assertive' ); 535 wp.a11y.speak( 536 sprintf( 537 /* translators: %s: The name of a city. */ 538 __( 'City updated. Listing events near %s.' ), 539 templateParams.location.description 540 ), 541 'assertive' 542 ); 536 543 } 537 544 … … 543 550 template = wp.template( 'community-events-could-not-locate' ); 544 551 $( '.community-events-could-not-locate' ).html( template( templateParams ) ); 545 wp.a11y.speak( communityEventsData.l10n.could_not_locate_city.replace( l10nPlaceholder, templateParams.unknownCity ) ); 552 wp.a11y.speak( 553 sprintf( 554 /* 555 * These specific examples were chosen to highlight the fact that a 556 * state is not needed, even for cities whose name is not unique. 557 * It would be too cumbersome to include that in the instructions 558 * to the user, so it's left as an implication. 559 */ 560 /* 561 * translators: %s is the name of the city we couldn't locate. 562 * Replace the examples with cities related to your locale. Test that 563 * they match the expected location and have upcoming events before 564 * including them. If no cities related to your locale have events, 565 * then use cities related to your locale that would be recognizable 566 * to most users. Use only the city name itself, without any region 567 * or country. Use the endonym (native locale name) instead of the 568 * English name if possible. 569 */ 570 __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), 571 templateParams.unknownCity 572 ) 573 ); 546 574 547 575 elementVisibility['.community-events-errors'] = true; … … 555 583 * could be confusing or unnecessarily distracting. 556 584 */ 557 wp.a11y.speak( communityEventsData.l10n.error_occurred_please_try_again);585 wp.a11y.speak( __( 'An error occurred. Please try again.' ) ); 558 586 559 587 elementVisibility['.community-events-errors'] = true; 560 588 elementVisibility['.community-events-error-occurred'] = true; 561 589 } else { 562 $locationMessage.text( communityEventsData.l10n.enter_closest_city);590 $locationMessage.text( __( 'Enter your closest city to find nearby events.' ) ); 563 591 564 592 elementVisibility['#community-events-location-message'] = true; … … 792 820 } 793 821 }); 822 823 /** 824 * Removed in 5.6.0, needed for back-compatibility. 825 * 826 * @since 4.8.0 827 * @deprecated 5.6.0 828 * 829 * @type {object} 830 */ 831 window.communityEventsData.l10n = window.communityEventsData.l10n || { 832 enter_closest_city: '', 833 error_occurred_please_try_again: '', 834 attend_event_near_generic: '', 835 could_not_locate_city: '', 836 city_updated: '' 837 }; 838 839 window.communityEventsData.l10n = window.wp.deprecateL10nObject( 'communityEventsData.l10n', window.communityEventsData.l10n, '5.6.0' ); -
trunk/src/js/_enqueues/wp/theme-plugin-editor.js
r48923 r49151 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' ); -
trunk/src/js/_enqueues/wp/updates.js
r48923 r49151 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 /** -
trunk/src/wp-includes/script-loader.php
r49147 r49151 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 ); -
trunk/tests/qunit/index.html
r49146 r49151 83 83 <script src="fixtures/js-widgets-endpoint.js"></script> 84 84 <script src="fixtures/wp-api.js"></script> 85 <script src="fixtures/common.js"></script> 85 86 </div> 86 87
Note: See TracChangeset
for help on using the changeset viewer.