Ticket #38632: 38632.2.diff
File 38632.2.diff, 3.4 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/user.php
98 98 99 99 if ( isset( $_POST['locale'] ) ) { 100 100 $locale = sanitize_text_field( $_POST['locale'] ); 101 if ( ! in_array( $locale, get_available_languages(), true )) {101 if ( 'site-default' === $locale ) { 102 102 $locale = ''; 103 } elseif ( ! in_array( $locale, get_available_languages(), true ) ) { 104 $locale = 'en_US'; 103 105 } 104 106 105 $user->locale = ( '' === $locale ) ? 'en_US' :$locale;107 $user->locale = $locale; 106 108 } 107 109 } 108 110 -
src/wp-admin/user-edit.php
284 284 $user_locale = $profileuser->locale; 285 285 286 286 if ( 'en_US' === $user_locale ) { 287 $user_locale = false;288 } elseif ( ! in_array( $user_locale, $languages, true ) ) {289 $user_locale = get_locale();287 $user_locale = ''; 288 } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) { 289 $user_locale = 'site-default'; 290 290 } 291 291 292 292 wp_dropdown_languages( array( … … 294 294 'id' => 'locale', 295 295 'selected' => $user_locale, 296 296 'languages' => $languages, 297 'show_available_translations' => false 297 'show_available_translations' => false, 298 'show_site_locale_default' => true 298 299 ) ); 299 300 ?> 300 301 </td> -
src/wp-includes/l10n.php
1065 1065 * @type bool|int $echo Whether to echo the generated markup. Accepts 0, 1, or their 1066 1066 * boolean equivalents. Default 1. 1067 1067 * @type bool $show_available_translations Whether to show available translations. Default true. 1068 * @type bool $show_site_locale_default Whether to show an option to fall back to the site's locale. Default false. 1068 1069 * } 1069 1070 * @return string HTML content 1070 1071 */ … … 1078 1079 'selected' => '', 1079 1080 'echo' => 1, 1080 1081 'show_available_translations' => true, 1082 'show_site_locale_default' => false, 1081 1083 ) ); 1082 1084 1085 // English (United States) uses an empty string for the value attribute. 1086 if ( 'en_US' === $args['selected'] ) { 1087 $args['selected'] = ''; 1088 } 1089 1083 1090 $translations = $args['translations']; 1084 1091 if ( empty( $translations ) ) { 1085 1092 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); … … 1122 1129 if ( $translations_available ) { 1123 1130 $structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">'; 1124 1131 } 1125 $structure[] = '<option value="" lang="en" data-installed="1">English (United States)</option>'; 1132 1133 if ( $args['show_site_locale_default'] ) { 1134 $structure[] = sprintf( '<option value="site-default" data-installed="1">%s</option>', _x( 'Site Default', 'default site language' ) ); 1135 } 1136 1137 $structure[] = sprintf( 1138 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1139 selected( '', $args['selected'], false ) 1140 ); 1141 1126 1142 foreach ( $languages as $language ) { 1127 1143 $structure[] = sprintf( 1128 1144 '<option value="%s" lang="%s"%s data-installed="1">%s</option>',