Make WordPress Core


Ignore:
Timestamp:
07/06/2020 08:15:46 PM (5 years ago)
Author:
ocean90
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r48347 r48348  
    11971197
    11981198        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
     1199        $scripts->set_translations( 'admin-comments' );
    11991200        did_action( 'init' ) && $scripts->localize(
    12001201            'admin-comments',
    1201             'adminCommentsL10n',
     1202            'adminCommentsSettings',
    12021203            array(
    12031204                'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
    12041205                'hotkeys_highlight_last'  => isset( $_GET['hotkeys_highlight_last'] ),
    1205                 'replyApprove'            => __( 'Approve and Reply' ),
    1206                 'reply'                   => __( 'Reply' ),
    1207                 'warnQuickEdit'           => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
    1208                 'warnCommentChanges'      => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
    1209                 'docTitleComments'        => __( 'Comments' ),
    1210                 /* translators: %s: Comments count. */
    1211                 'docTitleCommentsCount'   => __( 'Comments (%s)' ),
    12121206            )
    12131207        );
Note: See TracChangeset for help on using the changeset viewer.