Make WordPress Core


Ignore:
Timestamp:
07/07/2020 06:53:50 PM (6 years ago)
Author:
ocean90
Message:

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

File:
1 edited

Legend:

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

    r48395 r48396  
    11871187
    11881188    $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
     1189    $scripts->set_translations( 'media-editor' );
    11891190    $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
    11901191    $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
     
    12881289
    12891290        $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    1290         did_action( 'init' ) && $scripts->localize(
    1291             'set-post-thumbnail',
    1292             'setPostThumbnailL10n',
    1293             array(
    1294                 'setThumbnail' => __( 'Use as featured image' ),
    1295                 'saving'       => __( 'Saving...' ), // No ellipsis.
    1296                 'error'        => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    1297                 'done'         => __( 'Done' ),
    1298             )
    1299         );
     1291        $scripts->set_translations( 'set-post-thumbnail' );
    13001292
    13011293        /*
Note: See TracChangeset for help on using the changeset viewer.