I18N: Use wp.i18n for translatable strings in wp-admin/js/post.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 #50599.

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

View File

@@ -1219,35 +1219,6 @@ function wp_default_scripts( $scripts ) {
$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 );
$scripts->set_translations( 'post' );
did_action( 'init' ) && $scripts->localize(
'post',
'postL10n',
array(
'ok' => __( 'OK' ),
'cancel' => __( 'Cancel' ),
'publishOn' => __( 'Publish on:' ),
'publishOnFuture' => __( 'Schedule for:' ),
'publishOnPast' => __( 'Published on:' ),
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
'dateFormat' => __( '%1$s %2$s, %3$s at %4$s:%5$s' ),
'showcomm' => __( 'Show more comments' ),
'endcomm' => __( 'No more comments found.' ),
'publish' => __( 'Publish' ),
'schedule' => _x( 'Schedule', 'post action/button label' ),
'update' => __( 'Update' ),
'savePending' => __( 'Save as Pending' ),
'saveDraft' => __( 'Save Draft' ),
'private' => __( 'Private' ),
'public' => __( 'Public' ),
'publicSticky' => __( 'Public, Sticky' ),
'password' => __( 'Password Protected' ),
'privatelyPublished' => __( 'Privately Published' ),
'published' => __( 'Published' ),
'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
'savingText' => __( 'Saving Draft…' ),
'permalinkSaved' => __( 'Permalink saved' ),
)
);
$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );