Make WordPress Core


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

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

File:
1 edited

Legend:

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

    r48391 r48392  
    12611261
    12621262        $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
    1263         did_action( 'init' ) && $scripts->localize(
    1264             'plugin-install',
    1265             'plugininstallL10n',
    1266             array(
    1267                 'plugin_information' => __( 'Plugin:' ),
    1268                 'plugin_modal_label' => __( 'Plugin details' ),
    1269                 'ays'                => __( 'Are you sure you want to install this plugin?' ),
    1270             )
    1271         );
     1263        $scripts->set_translations( 'plugin-install' );
    12721264
    12731265        $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.