diff --git a/src/js/_enqueues/admin/media.js b/src/js/_enqueues/admin/media.js index 8b603205f6..c992b5d3a4 100644 --- a/src/js/_enqueues/admin/media.js +++ b/src/js/_enqueues/admin/media.js @@ -10,7 +10,7 @@ * @requires jQuery */ -/* global ajaxurl, attachMediaBoxL10n, _wpMediaGridSettings, showNotice, findPosts */ +/* global ajaxurl, _wpMediaGridSettings, showNotice, findPosts */ ( function( $ ){ window.findPosts = { @@ -124,12 +124,12 @@ spinner.removeClass( 'is-active' ); }).done( function( x ) { if ( ! x.success ) { - $( '#find-posts-response' ).text( attachMediaBoxL10n.error ); + $( '#find-posts-response' ).text( wp.i18n.__( 'An error has occurred. Please reload the page and try again.' ) ); } $( '#find-posts-response' ).html( x.data ); }).fail( function() { - $( '#find-posts-response' ).text( attachMediaBoxL10n.error ); + $( '#find-posts-response' ).text( wp.i18n.__( 'An error has occurred. Please reload the page and try again.' ) ); }); } }; diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index bc762340ca..3ff287211a 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -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' );