Make WordPress Core


Ignore:
Timestamp:
11/21/2014 03:19:53 AM (12 years ago)
Author:
johnbillion
Message:

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

See #30335

File:
1 edited

Legend:

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

    r30380 r30495  
    906906        }
    907907
     908        $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
     909
    908910        printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
    909911
     
    912914
    913915        // List installed languages.
    914         if ( $args['show_available_translations'] ) {
     916        if ( $translations_available ) {
    915917                $structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">';
    916918        }
     
    925927                );
    926928        }
    927         if ( $args['show_available_translations'] ) {
     929        if ( $translations_available ) {
    928930                $structure[] = '</optgroup>';
    929931        }
    930932
    931933        // List available translations.
    932         if ( ! empty( $translations ) && $args['show_available_translations'] ) {
     934        if ( $translations_available ) {
    933935                $structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">';
    934936                foreach ( $translations as $translation ) {
Note: See TracChangeset for help on using the changeset viewer.