Make WordPress Core


Ignore:
Timestamp:
07/02/2020 11:09:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

I18N: Use wp.i18n for translatable strings in wp-admin/js/privacy-tools.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, afercia.
See #20491.
Fixes #50535.

File:
1 edited

Legend:

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

    r48270 r48274  
    12061206    // To enqueue media-views or media-editor, call wp_enqueue_media().
    12071207    // Both rely on numerous settings, styles, and templates to operate correctly.
    1208     $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request', 'wp-a11y', 'wp-i18n', 'clipboard' ), false, 1 );
     1208    $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request', 'wp-a11y', 'clipboard' ), false, 1 );
    12091209    $scripts->set_translations( 'media-views' );
     1210
    12101211    $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
    12111212    $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
     
    13801381        );
    13811382
    1382         $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
     1383        $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
    13831384        $scripts->set_translations( 'site-health' );
    13841385
    1385         $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y', 'wp-i18n' ), false, 1 );
    1386         did_action( 'init' ) && $scripts->localize(
    1387             'privacy-tools',
    1388             'privacyToolsL10n',
    1389             array(
    1390                 'noDataFound'     => __( 'No personal data was found for this user.' ),
    1391                 'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
    1392                 'noneRemoved'     => __( 'Personal data was found for this user but was not erased.' ),
    1393                 'someNotRemoved'  => __( 'Personal data was found for this user but some of the personal data found was not erased.' ),
    1394                 'removalError'    => __( 'An error occurred while attempting to find and erase personal data.' ),
    1395                 'emailSent'       => __( 'The personal data export link for this user was sent.' ),
    1396                 'noExportFile'    => __( 'No personal data export file was generated.' ),
    1397                 'exportError'     => __( 'An error occurred while attempting to export personal data.' ),
    1398             )
    1399         );
     1386        $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
     1387        $scripts->set_translations( 'privacy-tools' );
    14001388
    14011389        $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.