Changeset 48387
- Timestamp:
- 07/07/2020 04:59:22 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/widgets.js
r47263 r48387 15 15 */ 16 16 hoveredSidebar: null, 17 18 /**19 * Translations.20 *21 * Exported from PHP in wp_default_scripts().22 *23 * @var {object}24 */25 l10n: {26 save: '{save}',27 saved: '{saved}',28 saveAlert: '{saveAlert}',29 widgetAdded: '{widgetAdded}'30 },31 17 32 18 /** … … 110 96 } ); 111 97 112 event.returnValue = wp Widgets.l10n.saveAlert;98 event.returnValue = wp.i18n.__( 'The changes you made will be lost if you navigate away from this page.' ); 113 99 return event.returnValue; 114 100 } … … 142 128 if ( ! widget.data( 'dirty-state-initialized' ) ) { 143 129 saveButton = inside.find( '.widget-control-save' ); 144 saveButton.prop( 'disabled', true ).val( wp Widgets.l10n.saved);130 saveButton.prop( 'disabled', true ).val( wp.i18n.__( 'Saved' ) ); 145 131 inside.on( 'input change', function() { 146 132 self.dirtyWidgets[ widgetId ] = true; 147 133 widget.addClass( 'widget-dirty' ); 148 saveButton.prop( 'disabled', false ).val( wp Widgets.l10n.save);134 saveButton.prop( 'disabled', false ).val( wp.i18n.__( 'Save' ) ); 149 135 }); 150 136 widget.data( 'dirty-state-initialized', true ); … … 587 573 588 574 // Re-disable the save button. 589 widget.find( '.widget-control-save' ).prop( 'disabled', true ).val( wp Widgets.l10n.saved);575 widget.find( '.widget-control-save' ).prop( 'disabled', true ).val( wp.i18n.__( 'Saved' ) ); 590 576 591 577 widget.removeClass( 'widget-dirty' ); … … 718 704 widget.find( '.widget-title' ).trigger('click'); 719 705 // At the end of the animation, announce the widget has been added. 720 window.wp.a11y.speak( wp Widgets.l10n.widgetAdded, 'assertive' );706 window.wp.a11y.speak( wp.i18n.__( 'Widget has been added to the selected sidebar' ), 'assertive' ); 721 707 }, 250 ); 722 708 }, -
trunk/src/wp-includes/script-loader.php
r48385 r48387 1240 1240 1241 1241 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-a11y' ), false, 1 ); 1242 did_action( 'init' ) && $scripts->add_inline_script( 1243 'admin-widgets', 1244 sprintf( 1245 'wpWidgets.l10n = %s;', 1246 wp_json_encode( 1247 array( 1248 'save' => __( 'Save' ), 1249 'saved' => __( 'Saved' ), 1250 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 1251 'widgetAdded' => __( 'Widget has been added to the selected sidebar' ), 1252 ) 1253 ) 1254 ) 1255 ); 1242 $scripts->set_translations( 'admin-widgets' ); 1256 1243 1257 1244 $scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
Note: See TracChangeset
for help on using the changeset viewer.