Make WordPress Core


Ignore:
Timestamp:
07/06/2020 07:45:04 PM (5 years ago)
Author:
ocean90
Message:

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

File:
1 edited

Legend:

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

    r48346 r48347  
    11941194    if ( is_admin() ) {
    11951195        $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
    1196         did_action( 'init' ) && $scripts->localize(
    1197             'admin-tags',
    1198             'tagsl10n',
    1199             array(
    1200                 'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
    1201                 'broken' => __( 'Something went wrong.' ),
    1202             )
    1203         );
     1196        $scripts->set_translations( 'admin-tags' );
    12041197
    12051198        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.