Ticket #29362: l10n.patch
File l10n.patch, 1.8 KB (added by , 10 years ago) |
---|
-
wp-includes\l10n.php
827 827 * @param array $args Optional arguments. Default empty array. 828 828 */ 829 829 function wp_dropdown_languages( $args = array() ) { 830 if ( isset( $args['languages'] ) ) { 831 $languages = $args['languages']; 832 } else { 833 $languages = get_available_languages(); 830 831 $args = wp_parse_args( $args, array( 832 'id' > '', 833 'name' => '', 834 'class' => '', 835 'tabindex' => 0, 836 'selected' => '', 837 'languages' => array(), 838 'echo' => true, 839 ) ); 840 841 if ( empty( $args['languages'] ) ) { 842 $args['languages'] = get_available_languages(); 834 843 } 835 844 836 printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); 837 echo '<option value="">en_US</option>'; 838 foreach ( $languages as $language ) { 845 $select_atts = array( 846 'name' => $args['name'], 847 'id' => $args['id'], 848 'class' => $args['class'], 849 ); 850 851 if ( (int) $args['tabindex'] > 0 ) { 852 $select_atts['tabindex'] = $args['tab_index']; 853 } 854 855 foreach( $select_atts as $key => $value ) { 856 $select_atts .= sprintf( ' %s=%s', $key, esc_attr( $value ) ); 857 } 858 859 $output = "<select{$select_atts}>"; 860 $output .= '<option value="">en_US</option>'; 861 862 foreach ( $args['languages'] as $language ) { 839 863 $selected = selected( $language, $args['selected'], false ); 840 echo'<option value="' . esc_attr( $language ) .'"' . $selected . '>' . $language . '</option>';864 $output .= '<option value="' . esc_attr( $language ) .'"' . $selected . '>' . $language . '</option>'; 841 865 } 842 echo '</select>'; 866 867 $output .= '</select>'; 868 869 $output = apply_filters( 'wp_dropdown_languages', $output, $args ); 870 871 if ( ! $args['echo'] ) { 872 return $output; 843 873 } 874 875 echo $output; 876 877 }