Changeset 52058 for trunk/src/wp-includes/l10n.php
- Timestamp:
- 11/08/2021 10:36:11 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r51837 r52058 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'] ); 153 } 154 155 if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 156 $determined_locale = $wp_lang; 149 157 } 150 158 … … 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() … … 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. … … 1517 1528 'show_option_site_default' => false, 1518 1529 'show_option_en_us' => true, 1530 'explicit_option_en_us' => false, 1519 1531 ) 1520 1532 ); … … 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 } … … 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 );
Note: See TracChangeset
for help on using the changeset viewer.