I18N: Use wp.i18n for translatable strings in wp-admin/js/media.js.

This removes the usage of `wp_localize_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.

Props swissspidy, ocean90.
See #20491.
Fixes #50597.

git-svn-id: https://develop.svn.wordpress.org/trunk@48384 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2020-07-07 16:12:14 +00:00
parent e39812fe53
commit b24fbd088b
2 changed files with 4 additions and 10 deletions

View File

@@ -1357,13 +1357,7 @@ function wp_default_scripts( $scripts ) {
$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'media',
'attachMediaBoxL10n',
array(
'error' => __( 'An error has occurred. Please reload the page and try again.' ),
)
);
$scripts->set_translations( 'media' );
$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'json2', 'imgareaselect', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'image-edit' );