Only output an optgroup for installed languages in wp_dropdown_languages() if translations are available.

See #30335

Built from https://develop.svn.wordpress.org/trunk@30495


git-svn-id: http://core.svn.wordpress.org/trunk@30484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2014-11-21 03:20:22 +00:00
parent 57e358da63
commit 3ace1fac81
2 changed files with 6 additions and 4 deletions

View File

@ -905,13 +905,15 @@ function wp_dropdown_languages( $args = array() ) {
} }
} }
$translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
// Holds the HTML markup. // Holds the HTML markup.
$structure = array(); $structure = array();
// List installed languages. // List installed languages.
if ( $args['show_available_translations'] ) { if ( $translations_available ) {
$structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">'; $structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">';
} }
$structure[] = '<option value="" lang="en" data-installed="1">English (United States)</option>'; $structure[] = '<option value="" lang="en" data-installed="1">English (United States)</option>';
@ -924,12 +926,12 @@ function wp_dropdown_languages( $args = array() ) {
esc_html( $language['native_name'] ) esc_html( $language['native_name'] )
); );
} }
if ( $args['show_available_translations'] ) { if ( $translations_available ) {
$structure[] = '</optgroup>'; $structure[] = '</optgroup>';
} }
// List available translations. // List available translations.
if ( ! empty( $translations ) && $args['show_available_translations'] ) { if ( $translations_available ) {
$structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">'; $structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">';
foreach ( $translations as $translation ) { foreach ( $translations as $translation ) {
$structure[] = sprintf( $structure[] = sprintf(

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.1-beta2-30494'; $wp_version = '4.1-beta2-30495';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.