Ticket #43700: 43700.top.diff
File 43700.top.diff, 6.2 KB (added by , 3 years ago) |
---|
-
src/wp-admin/css/login.css
281 281 282 282 #login { 283 283 width: 320px; 284 padding: 8% 0 0;284 padding: 5% 0 0; 285 285 margin: auto; 286 286 } 287 287 … … 409 409 display: none; 410 410 } 411 411 412 #language-switcher { 413 padding: 0; 414 overflow: visible; 415 background: none; 416 border: none; 417 box-shadow: none; 418 } 419 420 #language-switcher select { 421 height: 30px; 422 margin-right: 0.5em; 423 } 424 425 .language-switcher { 426 margin: 0 auto 24px; 427 text-align: center; 428 } 429 430 .language-switcher label { 431 margin-right: 0.5em; 432 } 433 434 .login .language-switcher .button-primary { 435 float: none; 436 margin-bottom: 0; 437 } 438 412 439 @media screen and (max-height: 550px) { 413 440 #login { 414 441 padding: 20px 0; 415 442 } 443 444 #language-switcher { 445 margin-top: 0; 446 } 416 447 } 417 448 418 449 … … 428 459 margin: -0.1875rem 0 0 -0.25rem; 429 460 } 430 461 } 462 463 @media screen and (max-width: 400px) { 464 .login .language-switcher .button-primary { 465 display: block; 466 margin: 5px auto 0; 467 } 468 } -
src/wp-includes/l10n.php
144 144 $determined_locale = get_user_locale(); 145 145 } 146 146 147 if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 148 $determined_locale = sanitize_text_field( $_GET['wp_lang'] ); 147 $wp_lang = ''; 148 149 if ( ! empty( $_GET['wp_lang'] ) ) { 150 $wp_lang = $_GET['wp_lang']; 151 } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) { 152 $wp_lang = $_COOKIE['wp_lang']; 149 153 } 150 154 155 if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 156 $determined_locale = sanitize_text_field( $wp_lang ); 157 } 158 151 159 /** 152 160 * Filters the locale for the current request. 153 161 * … … 1480 1488 * @since 4.3.0 Introduced the `echo` argument. 1481 1489 * @since 4.7.0 Introduced the `show_option_site_default` argument. 1482 1490 * @since 5.1.0 Introduced the `show_option_en_us` argument. 1491 * @since 5.9.0 Introduced the `explicit_option_en_us` argument. 1483 1492 * 1484 1493 * @see get_available_languages() 1485 1494 * @see wp_get_available_translations() … … 1499 1508 * @type bool $show_available_translations Whether to show available translations. Default true. 1500 1509 * @type bool $show_option_site_default Whether to show an option to fall back to the site's locale. Default false. 1501 1510 * @type bool $show_option_en_us Whether to show an option for English (United States). Default true. 1511 * @type bool $explicit_option_en_us Whether the English (United States) option uses an explict value of en_US 1512 * instead of an empty value. Default false. 1502 1513 * } 1503 1514 * @return string HTML dropdown list of languages. 1504 1515 */ … … 1516 1527 'show_available_translations' => true, 1517 1528 'show_option_site_default' => false, 1518 1529 'show_option_en_us' => true, 1530 'explicit_option_en_us' => false, 1519 1531 ) 1520 1532 ); 1521 1533 … … 1525 1537 } 1526 1538 1527 1539 // English (United States) uses an empty string for the value attribute. 1528 if ( 'en_US' === $parsed_args['selected'] ) {1540 if ( 'en_US' === $parsed_args['selected'] && ! $parsed_args['explicit_option_en_us'] ) { 1529 1541 $parsed_args['selected'] = ''; 1530 1542 } 1531 1543 … … 1580 1592 } 1581 1593 1582 1594 if ( $parsed_args['show_option_en_us'] ) { 1595 $value = ( $parsed_args['explicit_option_en_us'] ) ? 'en_US' : ''; 1583 1596 $structure[] = sprintf( 1584 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1597 '<option value="%s" lang="en" data-installed="1"%s>English (United States)</option>', 1598 esc_attr( $value ), 1585 1599 selected( '', $parsed_args['selected'], false ) 1586 1600 ); 1587 1601 } -
src/wp-login.php
207 207 ?> 208 208 <div id="login"> 209 209 <h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1> 210 211 <?php 212 $languages = get_available_languages(); 213 214 if ( ! empty( $languages ) && ! $interim_login ) { ?> 215 216 <div class="language-switcher"> 217 <form id="language-switcher" action="" method="get"> 218 219 <label for="language-switcher-locales"> 220 <span class="dashicons dashicons-translation" aria-hidden="true"></span> 221 <span class="screen-reader-text"><?php _e( 'Language' ); ?></span> 222 </label> 223 224 <?php 225 $args = array( 226 'id' => 'language-switcher-locales', 227 'name' => 'wp_lang', 228 'selected' => determine_locale(), 229 'show_available_translations' => false, 230 'explicit_option_en_us' => true, 231 'languages' => $languages, 232 ); 233 234 /** 235 * Filters default arguments for the Languages dropdown on the login screen. 236 * 237 * @since 5.9.0 238 * 239 * @param Array $args Arguments for the Languages dropdown on the login screen. 240 */ 241 wp_dropdown_languages( apply_filters( 'wp_login_language_switcher_args', $args ) ); 242 ?> 243 244 <?php if ( $interim_login ) { ?> 245 <input type="hidden" name="interim-login" value="1" /> 246 <?php } ?> 247 248 <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> 249 <input type="hidden" name="redirect_to" value="<?php echo esc_url_raw( $_GET['redirect_to'] ) ?>" /> 250 <?php } ?> 251 252 <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> 253 <input type="hidden" name="action" value="<?php echo sanitize_text_field( $_GET['action'] ) ?>" /> 254 <?php } ?> 255 256 <input type="submit" class="button button-primary" value="<?php _e( 'Change' ); ?>"> 257 258 </form> 259 </div> 260 261 <?php } ?> 262 210 263 <?php 211 264 /** 212 265 * Filters the message to display above the login form. … … 419 472 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 420 473 } 421 474 475 if ( isset( $_GET['wp_lang'] ) ) { 476 setcookie( 'wp_lang', $_GET['wp_lang'], 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); 477 } 478 422 479 /** 423 480 * Fires when the login form is initialized. 424 481 *