Make WordPress Core


Ignore:
Timestamp:
07/01/2020 08:36:32 PM (5 years ago)
Author:
ocean90
Message:

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

File:
1 edited

Legend:

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

    r48268 r48270  
    10661066
    10671067    $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
    1068     did_action( 'init' ) && $scripts->localize(
    1069         'user-profile',
    1070         'userProfileL10n',
    1071         array(
    1072             'warn'     => __( 'Your new password has not been saved.' ),
    1073             'warnWeak' => __( 'Confirm use of weak password' ),
    1074             'show'     => __( 'Show' ),
    1075             'hide'     => __( 'Hide' ),
    1076             'cancel'   => __( 'Cancel' ),
    1077             'ariaShow' => esc_attr__( 'Show password' ),
    1078             'ariaHide' => esc_attr__( 'Hide password' ),
    1079         )
    1080     );
     1068    $scripts->set_translations( 'user-profile' );
    10811069
    10821070    $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.