mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
I18N: Use wp.i18n for translatable strings in wp-admin/js/set-post-thumbnail.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 #50605. git-svn-id: https://develop.svn.wordpress.org/trunk@48396 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user