[wp-trac] [WordPress Trac] #58284: Add in wp_dropdown_languages en_US as selected value when 'explicit_option_en_us' is set to true

WordPress Trac noreply at wordpress.org
Wed May 10 11:57:49 UTC 2023


#58284: Add in wp_dropdown_languages en_US as selected value when
'explicit_option_en_us'  is set to true
--------------------------+-------------------------------------
 Reporter:  ekaliva       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:
 Severity:  normal        |   Keywords:  has-patch needs-testing
  Focuses:                |
--------------------------+-------------------------------------
 When in the function "wp_dropdown_languages" the option
 "explicit_option_en_us" is set to true and the locale-value of the User is
 "en_us" the option is still not selected. The value in the selected
 function (l10n.php, L. 1591) is empty:
 {{{#!php
 <?php
 selected( '', $parsed_args['selected'], false )
 }}}

 This cause problems when the default language of the WMPU network is set
 from english to another language.

 The bugfix could be the following (l10n.php L. 1586 - L.1593):
 {{{#!php
 <?php
 if ( $parsed_args['show_option_en_us'] ) {
                 $value       = ( $parsed_args['explicit_option_en_us'] ) ?
 'en_US' : '';
                 $structure[] = sprintf(
                         '<option value="%s" lang="en" data-
 installed="1"%s>English (United States)</option>',
                         esc_attr( $value ),
                         selected( $value, $parsed_args['selected'], false
 )
                 );
         }
 }}}

 Thank you very much

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58284>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list