Make WordPress Core


Ignore:
Timestamp:
01/09/2019 11:45:02 AM (6 years ago)
Author:
swissspidy
Message:

I18N: Add option to hide en_US locale in wp_dropdown_languages().

Props danieltj for initial patch.
Fixes #44494.

File:
1 edited

Legend:

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

    r44418 r44514  
    13651365 * @since 4.3.0 Introduced the `echo` argument.
    13661366 * @since 4.7.0 Introduced the `show_option_site_default` argument.
     1367 * @since 5.1.0 Introduced the `show_option_en_us` argument.
    13671368 *
    13681369 * @see get_available_languages()
     
    13831384 *     @type bool     $show_available_translations  Whether to show available translations. Default true.
    13841385 *     @type bool     $show_option_site_default     Whether to show an option to fall back to the site's locale. Default false.
     1386 *     @type bool     $show_option_en_us            Whether to show an option for English (United States). Default true.
    13851387 * }
    13861388 * @return string HTML content
     
    13991401            'show_available_translations' => true,
    14001402            'show_option_site_default'    => false,
     1403            'show_option_en_us'           => true,
    14011404        )
    14021405    );
     
    14621465    }
    14631466
    1464     // Always show English.
    1465     $structure[] = sprintf(
    1466         '<option value="" lang="en" data-installed="1"%s>English (United States)</option>',
    1467         selected( '', $parsed_args['selected'], false )
    1468     );
     1467    if ( $parsed_args['show_option_en_us'] ) {
     1468        $structure[] = sprintf(
     1469            '<option value="" lang="en" data-installed="1"%s>English (United States)</option>',
     1470            selected( '', $parsed_args['selected'], false )
     1471        );
     1472    }
    14691473
    14701474    // List installed languages.
Note: See TracChangeset for help on using the changeset viewer.