Passwords: Make show/hide toggle translatable.

See #32589.


git-svn-id: https://develop.svn.wordpress.org/trunk@33249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-07-13 22:34:18 +00:00
parent e7e337c4e6
commit a48af6ef86
5 changed files with 11 additions and 6 deletions

View File

@ -143,7 +143,7 @@ function display_setup_form( $error = null ) {
<input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" />
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0">
<span class="dashicons dashicons-visibility"></span>
<span class="text">hide</span>
<span class="text"><?php _e( 'Hide' ); ?></span>
</button>
<div id="pass-strength-result"></div>
</div>

View File

@ -1,4 +1,4 @@
/* global ajaxurl, pwsL10n */
/* global ajaxurl, pwsL10n, userProfileL10n */
(function($){
$(function(){
var pw_new = $('.user-pass1-wrap'),
@ -96,13 +96,13 @@
pw_field.attr( 'type', 'text' );
pw_togglebtn.attr( 'data-toggle', 0 )
.find( '.text' )
.text( 'hide' )
.text( userProfileL10n.hide )
;
} else {
pw_field.attr( 'type', 'password' );
pw_togglebtn.attr( 'data-toggle', 1 )
.find( '.text' )
.text( 'show' )
.text( userProfileL10n.show )
;
}
pw_field.focus();

View File

@ -467,7 +467,7 @@ if ( $show_password_fields ) :
<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" />
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0">
<span class="dashicons dashicons-visibility"></span>
<span class="text">hide</span>
<span class="text"><?php _e( 'Hide' ); ?></span>
</button>
<div style="display:none" id="pass-strength-result"></div>
</div>

View File

@ -405,7 +405,7 @@ if ( apply_filters( 'show_password_fields', true ) ) : ?>
<input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" />
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0">
<span class="dashicons dashicons-visibility"></span>
<span class="text">hide</span>
<span class="text"><?php _e( 'Hide' ); ?></span>
</button>
<div style="display:none" id="pass-strength-result"></div>
</div>

View File

@ -373,6 +373,11 @@ function wp_default_scripts( &$scripts ) {
) );
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array(
'show' => __( 'Show' ),
'hide' => __( 'Hide' ),
) );
$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );