diff --git a/src/js/_enqueues/admin/post.js b/src/js/_enqueues/admin/post.js index 2ca60e7c4b..0fc9a17d21 100644 --- a/src/js/_enqueues/admin/post.js +++ b/src/js/_enqueues/admin/post.js @@ -4,7 +4,7 @@ * @output wp-admin/js/post.js */ - /* global ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, ClipboardJS */ + /* global ajaxurl, wpAjax, postboxes, pagenow, tinymce, alert, deleteUserSetting, ClipboardJS */ /* global theList:true, theExtraList:true, getUserSetting, setUserSetting, commentReply, commentsBox */ /* global WPSetThumbnailHTML, wptitlehint */ @@ -145,7 +145,7 @@ window.wp = window.wp || {}; */ function(str){ if ( str == '0' ) { - alert( setPostThumbnailL10n.error ); + alert( __( 'Could not set that as the thumbnail image. Try a different attachment.' ) ); } else { WPSetThumbnailHTML(str); } diff --git a/src/js/_enqueues/admin/set-post-thumbnail.js b/src/js/_enqueues/admin/set-post-thumbnail.js index 0f3849af34..5f5f565564 100644 --- a/src/js/_enqueues/admin/set-post-thumbnail.js +++ b/src/js/_enqueues/admin/set-post-thumbnail.js @@ -2,23 +2,23 @@ * @output wp-admin/js/set-post-thumbnail.js */ -/* global setPostThumbnailL10n, ajaxurl, post_id, alert */ +/* global ajaxurl, post_id, alert */ /* exported WPSetAsThumbnail */ window.WPSetAsThumbnail = function( id, nonce ) { var $link = jQuery('a#wp-post-thumbnail-' + id); - $link.text( setPostThumbnailL10n.saving ); + $link.text( wp.i18n.__( 'Saving…' ) ); jQuery.post(ajaxurl, { action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie ) }, function(str){ var win = window.dialogArguments || opener || parent || top; - $link.text( setPostThumbnailL10n.setThumbnail ); + $link.text( wp.i18n.__( 'Use as featured image' ) ); if ( str == '0' ) { - alert( setPostThumbnailL10n.error ); + alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) ); } else { jQuery('a.wp-post-thumbnail').show(); - $link.text( setPostThumbnailL10n.done ); + $link.text( wp.i18n.__( 'Done' ) ); $link.fadeOut( 2000 ); win.WPSetThumbnailID(id); win.WPSetThumbnailHTML(str); diff --git a/src/js/_enqueues/wp/media/editor.js b/src/js/_enqueues/wp/media/editor.js index b74780d928..cc0167682a 100644 --- a/src/js/_enqueues/wp/media/editor.js +++ b/src/js/_enqueues/wp/media/editor.js @@ -627,7 +627,7 @@ _wpnonce: settings.post.nonce }).done( function( html ) { if ( '0' === html ) { - window.alert( window.setPostThumbnailL10n.error ); + window.alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) ); return; } $( '.inside', '#postimagediv' ).html( html ); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 04994da384..f0404830bd 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1186,6 +1186,7 @@ function wp_default_scripts( $scripts ) { $scripts->set_translations( 'media-views' ); $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 ); + $scripts->set_translations( 'media-editor' ); $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 ); $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 ); @@ -1287,16 +1288,7 @@ function wp_default_scripts( $scripts ) { $scripts->set_translations( 'image-edit' ); $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 ); - did_action( 'init' ) && $scripts->localize( - 'set-post-thumbnail', - 'setPostThumbnailL10n', - array( - 'setThumbnail' => __( 'Use as featured image' ), - 'saving' => __( 'Saving...' ), // No ellipsis. - 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ), - 'done' => __( 'Done' ), - ) - ); + $scripts->set_translations( 'set-post-thumbnail' ); /* * Navigation Menus: Adding underscore as a dependency to utilize _.debounce