Make WordPress Core


Ignore:
Timestamp:
07/06/2020 08:58:06 PM (4 years ago)
Author:
ocean90
Message:

I18N: Use wp.i18n for translatable strings in wp-admin/js/tags-box.js and wp-admin/js/tags-suggest.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 #50579.

File:
1 edited

Legend:

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

    r48348 r48350  
    12131213
    12141214        $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
     1215        $scripts->set_translations( 'tags-box' );
    12151216
    12161217        $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
    1217         did_action( 'init' ) && $scripts->localize(
    1218             'tags-suggest',
    1219             'tagsSuggestL10n',
    1220             array(
    1221                 'tagDelimiter' => _x( ',', 'tag delimiter' ),
    1222                 'removeTerm'   => __( 'Remove term:' ),
    1223                 'termSelected' => __( 'Term selected.' ),
    1224                 'termAdded'    => __( 'Term added.' ),
    1225                 'termRemoved'  => __( 'Term removed.' ),
    1226             )
    1227         );
     1218        $scripts->set_translations( 'tags-suggest' );
    12281219
    12291220        $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 );
Note: See TracChangeset for help on using the changeset viewer.