Ticket #43700: 43700.7.diff
File 43700.7.diff, 6.5 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 … … 321 321 .login .privacy-policy-page-link { 322 322 text-align: center; 323 323 width: 100%; 324 margin: 5em 0 2em;324 margin: 3em 0 2em; 325 325 } 326 326 327 327 .login form .input, … … 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 margin-right: 0.25em; 422 } 423 424 .language-switcher { 425 margin: 0 auto; 426 padding: 0 0 24px; 427 text-align: center; 428 } 429 430 .language-switcher label { 431 margin-right: 0.25em; 432 } 433 434 .language-switcher label .dashicons { 435 width: auto; 436 height: auto; 437 } 438 439 .login .language-switcher .button-primary { 440 float: none; 441 margin-bottom: 0; 442 } 443 412 444 @media screen and (max-height: 550px) { 413 445 #login { 414 446 padding: 20px 0; 415 447 } 448 449 #language-switcher { 450 margin-top: 0; 451 } 416 452 } 417 453 418 454 … … 427 463 height: 1.3125rem; 428 464 margin: -0.1875rem 0 0 -0.25rem; 429 465 } 466 467 #language-switcher label, 468 #language-switcher select { 469 margin-right: 0; 470 } 430 471 } 472 473 @media screen and (max-width: 400px) { 474 .login .language-switcher .button-primary { 475 display: block; 476 margin: 5px auto 0; 477 } 478 479 #language-switcher .button { 480 margin-top: .5em; 481 } 482 } -
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 = sanitize_text_field( $_GET['wp_lang'] ); 151 } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) { 152 $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); 149 153 } 150 154 155 if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 156 $determined_locale = $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
312 312 </div><?php // End of <div id="login">. ?> 313 313 314 314 <?php 315 $languages = get_available_languages(); 315 316 317 if ( ! empty( $languages ) && ! $interim_login ) { ?> 318 319 <div class="language-switcher"> 320 <form id="language-switcher" action="" method="get"> 321 322 <label for="language-switcher-locales"> 323 <span class="dashicons dashicons-translation" aria-hidden="true"></span> 324 <span class="screen-reader-text"><?php _e( 'Language' ); ?></span> 325 </label> 326 327 <?php 328 $args = array( 329 'id' => 'language-switcher-locales', 330 'name' => 'wp_lang', 331 'selected' => determine_locale(), 332 'show_available_translations' => false, 333 'explicit_option_en_us' => true, 334 'languages' => $languages, 335 ); 336 337 /** 338 * Filters default arguments for the Languages select input on the login screen. 339 * 340 * @since 5.9.0 341 * 342 * @param array $args Arguments for the Languages select input on the login screen. 343 */ 344 wp_dropdown_languages( apply_filters( 'wp_login_language_switcher_args', $args ) ); 345 ?> 346 347 <?php if ( $interim_login ) { ?> 348 <input type="hidden" name="interim-login" value="1" /> 349 <?php } ?> 350 351 <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> 352 <input type="hidden" name="redirect_to" value="<?php echo esc_url_raw( $_GET['redirect_to'] ); ?>" /> 353 <?php } ?> 354 355 <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> 356 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" /> 357 <?php } ?> 358 359 <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Change' ); ?>"> 360 361 </form> 362 </div> 363 364 <?php } ?> 365 366 <?php 367 316 368 if ( ! empty( $input_id ) ) { 317 369 ?> 318 370 <script type="text/javascript"> … … 419 471 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 420 472 } 421 473 474 if ( isset( $_GET['wp_lang'] ) ) { 475 setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); 476 } 477 422 478 /** 423 479 * Fires when the login form is initialized. 424 480 *