Changeset 48385
- Timestamp:
- 07/07/2020 04:47:14 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/post.js
r48318 r48385 5 5 */ 6 6 7 /* global postL10n,ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, ClipboardJS */7 /* global ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, ClipboardJS */ 8 8 /* global theList:true, theExtraList:true, getUserSetting, setUserSetting, commentReply, commentsBox */ 9 9 /* global WPSetThumbnailHTML, wptitlehint */ … … 16 16 17 17 ( function( $ ) { 18 var titleHasFocus = false; 18 var titleHasFocus = false, 19 __ = wp.i18n.__; 19 20 20 21 /** … … 74 75 $('#show-comments').hide(); 75 76 else 76 $('#show-comments').show().children('a'). html(postL10n.showcomm);77 $('#show-comments').show().children('a').text( __( 'Show more comments' ) ); 77 78 78 79 return; 79 80 } else if ( 1 == r ) { 80 $('#show-comments'). html(postL10n.endcomm);81 $('#show-comments').text( __( 'No more comments found.' ) ); 81 82 return; 82 83 } … … 296 297 jQuery(document).ready( function($) { 297 298 var stamp, visibility, $submitButtons, updateVisibility, updateText, 298 sticky = '',299 299 $textarea = $('#content'), 300 300 $document = $(document), … … 308 308 copyAttachmentURLClipboard = new ClipboardJS( '.copy-attachment-url.edit-media' ), 309 309 copyAttachmentURLSuccessTimeout, 310 __ = wp.i18n.__ ;310 __ = wp.i18n.__, _x = wp.i18n._x; 311 311 312 312 postboxes.add_postbox_toggles(pagenow); … … 476 476 } 477 477 }).on( 'before-autosave.edit-post', function() { 478 $( '.autosave-message' ).text( postL10n.savingText);478 $( '.autosave-message' ).text( __( 'Saving Draft…' ) ); 479 479 }).on( 'after-autosave.edit-post', function( event, data ) { 480 480 $( '.autosave-message' ).text( data.message ); … … 495 495 ( wp.autosave && wp.autosave.server.postChanged() ) ) { 496 496 497 return postL10n.saveAlert;497 return __( 'The changes you made will be lost if you navigate away from this page.' ); 498 498 } 499 499 }).on( 'unload.edit-post', function( event ) { … … 755 755 // Determine what the publish should be depending on the date and post status. 756 756 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { 757 publishOn = postL10n.publishOnFuture;758 $('#publish').val( postL10n.schedule);757 publishOn = __( 'Schedule for:' ); 758 $('#publish').val( _x( 'Schedule', 'post action/button label' ) ); 759 759 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { 760 publishOn = postL10n.publishOn;761 $('#publish').val( postL10n.publish);762 } else { 763 publishOn = postL10n.publishOnPast;764 $('#publish').val( postL10n.update);760 publishOn = __( 'Publish on:' ); 761 $('#publish').val( __( 'Publish' ) ); 762 } else { 763 publishOn = __( 'Published on:' ); 764 $('#publish').val( __( 'Update' ) ); 765 765 } 766 766 … … 772 772 $('#timestamp').html( 773 773 '\n' + publishOn + ' <b>' + 774 postL10n.dateFormat 774 // translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. 775 __( '%1$s %2$s, %3$s at %4$s:%5$s' ) 775 776 .replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) ) 776 777 .replace( '%2$s', parseInt( jj, 10 ) ) … … 784 785 // Add "privately published" to post status when applies. 785 786 if ( $postVisibilitySelect.find('input:radio:checked').val() == 'private' ) { 786 $('#publish').val( postL10n.update);787 $('#publish').val( __( 'Update' ) ); 787 788 if ( 0 === optPublish.length ) { 788 postStatus.append('<option value="publish">' + postL10n.privatelyPublished+ '</option>');789 postStatus.append('<option value="publish">' + __( 'Privately Published' ) + '</option>'); 789 790 } else { 790 optPublish.html( postL10n.privatelyPublished);791 optPublish.html( __( 'Privately Published' ) ); 791 792 } 792 793 $('option[value="publish"]', postStatus).prop('selected', true); … … 799 800 } 800 801 } else { 801 optPublish.html( postL10n.published);802 optPublish.html( __( 'Published' ) ); 802 803 } 803 804 if ( postStatus.is(':hidden') ) … … 817 818 $('#save-post').show(); 818 819 if ( $('option:selected', postStatus).val() == 'pending' ) { 819 $('#save-post').show().val( postL10n.savePending);820 $('#save-post').show().val( __( 'Save as Pending' ) ); 820 821 } else { 821 $('#save-post').show().val( postL10n.saveDraft);822 $('#save-post').show().val( __( 'Save Draft' ) ); 822 823 } 823 824 } … … 851 852 // Set the selected visibility as current. 852 853 $postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // Crazyhorse - multiple OK cancels. 854 var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val(); 855 853 856 $postVisibilitySelect.slideUp('fast'); 854 857 $('#visibility .edit-visibility').show().focus(); 855 858 updateText(); 856 859 857 if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public') {860 if ( 'public' !== selectedVisibility ) { 858 861 $('#sticky').prop('checked', false); 859 862 } 860 863 861 if ( $('#sticky').prop('checked') ) { 862 sticky = 'Sticky'; 863 } else { 864 sticky = ''; 865 } 866 867 $('#post-visibility-display').html( postL10n[ $postVisibilitySelect.find('input:radio:checked').val() + sticky ] ); 864 switch ( selectedVisibility ) { 865 case 'public': 866 visibilityLabel = $( '#sticky' ).prop( 'checked' ) ? __( 'Public, Sticky' ) : __( 'Public' ); 867 break; 868 case 'private': 869 visibilityLabel = __( 'Private' ); 870 break; 871 case 'password': 872 visibilityLabel = __( 'Password Protected' ); 873 break; 874 } 875 876 $('#post-visibility-display').text( visibilityLabel ); 868 877 event.preventDefault(); 869 878 }); … … 978 987 revert_e = $el.html(); 979 988 980 buttons.html( '<button type="button" class="save button button-small">' + postL10n.ok + '</button> <button type="button" class="cancel button-link">' + postL10n.cancel+ '</button>' );989 buttons.html( '<button type="button" class="save button button-small">' + __( 'OK' ) + '</button> <button type="button" class="cancel button-link">' + __( 'Cancel' ) + '</button>' ); 981 990 982 991 // Save permalink changes. … … 1011 1020 real_slug.val(new_slug); 1012 1021 $( '.edit-slug' ).focus(); 1013 wp.a11y.speak( postL10n.permalinkSaved);1022 wp.a11y.speak( __( 'Permalink saved' ) ); 1014 1023 } 1015 1024 ); -
trunk/src/wp-includes/script-loader.php
r48384 r48385 1220 1220 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ), false, 1 ); 1221 1221 $scripts->set_translations( 'post' ); 1222 did_action( 'init' ) && $scripts->localize(1223 'post',1224 'postL10n',1225 array(1226 'ok' => __( 'OK' ),1227 'cancel' => __( 'Cancel' ),1228 'publishOn' => __( 'Publish on:' ),1229 'publishOnFuture' => __( 'Schedule for:' ),1230 'publishOnPast' => __( 'Published on:' ),1231 /* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */1232 'dateFormat' => __( '%1$s %2$s, %3$s at %4$s:%5$s' ),1233 'showcomm' => __( 'Show more comments' ),1234 'endcomm' => __( 'No more comments found.' ),1235 'publish' => __( 'Publish' ),1236 'schedule' => _x( 'Schedule', 'post action/button label' ),1237 'update' => __( 'Update' ),1238 'savePending' => __( 'Save as Pending' ),1239 'saveDraft' => __( 'Save Draft' ),1240 'private' => __( 'Private' ),1241 'public' => __( 'Public' ),1242 'publicSticky' => __( 'Public, Sticky' ),1243 'password' => __( 'Password Protected' ),1244 'privatelyPublished' => __( 'Privately Published' ),1245 'published' => __( 'Published' ),1246 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),1247 'savingText' => __( 'Saving Draft…' ),1248 'permalinkSaved' => __( 'Permalink saved' ),1249 )1250 );1251 1222 1252 1223 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.