mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +00:00
I18N: Use wp.i18n for translatable strings in wp-admin/js/widgets.js.
This removes the usage of `$scripts->add_inline_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities. Fixes #50600. git-svn-id: https://develop.svn.wordpress.org/trunk@48387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1239,20 +1239,7 @@ function wp_default_scripts( $scripts ) {
|
||||
$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
|
||||
|
||||
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-a11y' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->add_inline_script(
|
||||
'admin-widgets',
|
||||
sprintf(
|
||||
'wpWidgets.l10n = %s;',
|
||||
wp_json_encode(
|
||||
array(
|
||||
'save' => __( 'Save' ),
|
||||
'saved' => __( 'Saved' ),
|
||||
'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
|
||||
'widgetAdded' => __( 'Widget has been added to the selected sidebar' ),
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$scripts->set_translations( 'admin-widgets' );
|
||||
|
||||
$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
|
||||
$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
|
||||
|
||||
Reference in New Issue
Block a user