Changeset 28774
- Timestamp:
- 06/18/2014 07:57:21 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/install.css
r27855 r28774 312 312 313 313 } 314 315 .language-chooser select { 316 margin: 1px; 317 padding: 8px; 318 width: 100%; 319 display: block; 320 border: 1px solid #ddd; 321 -webkit-border-radius: 0; 322 border-radius: 0; /* Reset mobile webkit's default element styling */ 323 -webkit-transition: .05s border-color ease-in-out; 324 transition: .05s border-color ease-in-out; 325 outline: 0; 326 -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07); 327 box-shadow: inset 0 1px 2px rgba(0,0,0,0.07); 328 background-color: #fff; 329 color: #333; 330 font-size: 16px; 331 font-family: inherit; 332 font-weight: inherit; 333 } 334 335 .language-chooser select:focus { 336 border-color: #5b9dd9; 337 -webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8); 338 box-shadow: 0 0 2px rgba(30,140,190,0.8); 339 } 340 341 .wp-core-ui .language-chooser .button.button-hero { 342 font-size: 30px; 343 line-height: 30px; 344 } 345 346 .language-chooser p { 347 text-align: right; 348 } -
trunk/src/wp-admin/includes/upgrade.php
r28712 r28774 33 33 * @param null $deprecated Optional. Not used. 34 34 * @param string $user_password Optional. User's chosen password. Will default to a random password. 35 * @param string $language Optional. Language chosen. 35 36 * @return array Array keys 'url', 'user_id', 'password', 'password_message'. 36 37 */ 37 function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {38 function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) { 38 39 if ( !empty( $deprecated ) ) 39 40 _deprecated_argument( __FUNCTION__, '2.6' ); … … 48 49 update_option('admin_email', $user_email); 49 50 update_option('blog_public', $public); 51 52 if ( $language ) { 53 update_option( 'WPLANG', $language ); 54 } 50 55 51 56 $guessurl = wp_guess_url(); -
trunk/src/wp-admin/install.php
r28759 r28774 45 45 46 46 /** 47 * @todo rename, move 48 */ 49 function wp_get_available_translations() { 50 $url = 'http://api.wordpress.org/translations/core/1.0/'; 51 if ( wp_http_supports( array( 'ssl' ) ) ) { 52 $url = set_url_scheme( $url, 'https' ); 53 } 54 55 $options = array( 56 'timeout' => 3, 57 'body' => array( 'version' => $GLOBALS['wp_version'] ), 58 ); 59 60 $response = wp_remote_post( $url, $options ); 61 $body = wp_remote_retrieve_body( $response ); 62 if ( $body && $body = json_decode( $body, true ) ) { 63 return $body; 64 } 65 return false; 66 } 67 68 /** 47 69 * Display install header. 48 70 * … … 137 159 </table> 138 160 <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button button-large" /></p> 161 <input type="hidden" name="language" value="<?php echo isset( $_POST['language'] ) ? esc_attr( $_POST['language'] ) : ''; ?>" /> 139 162 </form> 140 163 <?php … … 170 193 171 194 switch($step) { 172 case 0: // Step 1 173 case 1: // Step 1, direct link. 174 display_header(); 195 case 0: // Step 0 196 if ( $body = wp_get_available_translations() ) { 197 display_header(); 198 199 echo '<form id="setup" method="post" action="install.php?step=1">'; 200 echo '<div class="language-chooser">'; 201 echo '<select name="language" id="language-chooser" size="15">'; 202 echo '<option selected="selected" value="">English (United States)</option>'; 203 foreach ( $body['languages'] as $language ) { 204 echo '<option value="' . esc_attr( $language['language'] ) . '">' . esc_html( $language['native_name'] ) . "</option>\n"; 205 } 206 echo "</select>\n"; 207 echo '<p class="step"><input type="submit" class="button button-primary button-hero" value="»" /></p>'; 208 echo '</div>'; 209 echo '</form>'; 210 break; 211 } 212 // Deliberately fall through if we can't reach the translations API. 213 214 case 1: // Step 1, direct link or from language chooser. 215 if ( ! empty( $_POST['language'] ) ) { 216 $body = wp_get_available_translations(); 217 foreach ( $body['languages'] as $language ) { 218 if ( $language['language'] === $_POST['language'] ) { 219 $loading_language = $_POST['language']; 220 break; 221 } 222 } 223 if ( ! empty( $loading_language ) ) { 224 require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 225 $skin = new Automatic_Upgrader_Skin; 226 $upgrader = new Language_Pack_Upgrader( $skin ); 227 $options = array( 'clear_update_cache' => false ); 228 $language['type'] = 'core'; 229 $language = (object) $language; 230 /** 231 * @todo failures (such as non-direct FS) 232 */ 233 $upgrader->upgrade( $language, array( 'clear_update_cache' => false ) ); 234 load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" ); 235 load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" ); 236 } 237 } 238 239 display_header(); 175 240 ?> 176 241 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> … … 184 249 break; 185 250 case 2: 251 $loading_language = ''; 252 if ( ! empty( $_POST['language'] ) ) { 253 $available_languages = get_available_languages(); 254 if ( isset( $available_languages[ $_POST['language'] ] ) ) { 255 $loading_language = $_POST['language']; 256 load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" ); 257 load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" ); 258 } 259 } 260 186 261 if ( ! empty( $wpdb->error ) ) 187 262 wp_die( $wpdb->error->get_error_message() ); … … 220 295 if ( $error === false ) { 221 296 $wpdb->show_errors(); 222 $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ) );297 $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loading_language ); 223 298 ?> 224 299 … … 251 326 if ( !wp_is_mobile() ) { 252 327 ?> 253 <script type="text/javascript">var t = document.getElementById('weblog_title') ; if (t){ t.focus(); }</script>328 <script type="text/javascript">var t = document.getElementById('weblog_title') || document.getElementById('language-chooser'); if (t){ t.focus(); }</script> 254 329 <?php } ?> 255 330 <?php wp_print_scripts( 'user-profile' ); ?> -
trunk/src/wp-includes/l10n.php
r28083 r28774 27 27 global $locale; 28 28 29 if ( isset( $locale ) ) 29 if ( isset( $locale ) ) { 30 30 /** 31 31 * Filter WordPress install's locale ID. … … 36 36 */ 37 37 return apply_filters( 'locale', $locale ); 38 } 38 39 39 40 // WPLANG is defined in wp-config. … … 49 50 if ( $ms_locale !== false ) 50 51 $locale = $ms_locale; 52 } elseif ( ! defined( 'WP_INSTALLING' ) ) { 53 $db_locale = get_option( 'WPLANG' ); 54 if ( $db_locale ) { 55 $locale = $db_locale; 56 } 51 57 } 52 58
Note: See TracChangeset
for help on using the changeset viewer.