diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 6e4fd80..996b05b 100644
a
|
b
|
function wp_install_language_form( $body ) { |
2183 | 2183 | } |
2184 | 2184 | |
2185 | 2185 | /** |
2186 | | * @todo rename, move |
| 2186 | * Get available languages from translations API |
| 2187 | * |
| 2188 | * @return boolean|array |
2187 | 2189 | */ |
2188 | | function wp_get_available_translations() { |
| 2190 | function wp_get_available_languages() { |
2189 | 2191 | $url = 'http://api.wordpress.org/translations/core/1.0/'; |
2190 | 2192 | if ( wp_http_supports( array( 'ssl' ) ) ) { |
2191 | 2193 | $url = set_url_scheme( $url, 'https' ); |
… |
… |
function wp_get_available_translations() { |
2213 | 2215 | function wp_install_download_language_pack( $language ) { |
2214 | 2216 | // Check if the language is already installed. |
2215 | 2217 | $available_languages = get_available_languages(); |
2216 | | if ( in_array( $language->language, $available_languages ) ) { |
2217 | | return $language->language; |
| 2218 | if ( in_array( $language, $available_languages ) ) { |
| 2219 | return $language; |
2218 | 2220 | } |
2219 | 2221 | |
2220 | 2222 | // Confirm the language is one we can download. |
2221 | | $body = wp_get_available_translations(); |
| 2223 | $body = wp_get_available_languages(); |
2222 | 2224 | $loading_language = false; |
2223 | 2225 | if ( $body ) { |
2224 | 2226 | foreach ( $body['languages'] as $language ) { |
… |
… |
function wp_install_download_language_pack( $language ) { |
2237 | 2239 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
2238 | 2240 | $skin = new Automatic_Upgrader_Skin; |
2239 | 2241 | $upgrader = new Language_Pack_Upgrader( $skin ); |
2240 | | $options = array( 'clear_update_cache' => false ); |
2241 | 2242 | $language->type = 'core'; |
2242 | 2243 | /** |
2243 | 2244 | * @todo failures (such as non-direct FS) |
2244 | 2245 | */ |
2245 | | $upgrader->upgrade( $language, array( 'clear_update_cache' => false ) ); |
| 2246 | $res = $upgrader->upgrade( $language, array( 'clear_update_cache' => false ) ); |
| 2247 | if ( is_null( $res ) ) |
| 2248 | return new WP_Error('fs_unavailable', $upgrader->strings['fs_unavailable'] ); |
| 2249 | |
2246 | 2250 | return $language->language; |
2247 | 2251 | } |
2248 | 2252 | |
diff --git a/wp-admin/install.php b/wp-admin/install.php
index a2cc028..9ef5c77 100644
a
|
b
|
if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
179 | 179 | switch($step) { |
180 | 180 | case 0: // Step 0 |
181 | 181 | |
182 | | if ( empty( $_GET['language'] ) && ( $body = wp_get_available_translations() ) ) { |
| 182 | if ( empty( $_GET['language'] ) && ( $body = wp_get_available_languages() ) ) { |
183 | 183 | display_header( 'language-chooser' ); |
184 | 184 | echo '<form id="setup" method="post" action="?step=1">'; |
185 | 185 | wp_install_language_form( $body ); |
diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php
index 199078a..3dd8e89 100644
a
|
b
|
function setup_config_display_header( $body_classes = array() ) { |
86 | 86 | switch($step) { |
87 | 87 | case -1: |
88 | 88 | |
89 | | if ( empty( $_GET['language'] ) && ( $body = wp_get_available_translations() ) ) { |
| 89 | if ( empty( $_GET['language'] ) && ( $body = wp_get_available_languages() ) ) { |
90 | 90 | setup_config_display_header( 'language-chooser' ); |
91 | 91 | echo '<form id="setup" method="post" action="?step=0">'; |
92 | 92 | wp_install_language_form( $body ); |
… |
… |
switch($step) { |
99 | 99 | case 0: |
100 | 100 | if ( ! empty( $_REQUEST['language'] ) ) { |
101 | 101 | $loaded_language = wp_install_download_language_pack( $_REQUEST['language'] ); |
102 | | if ( $loaded_language ) { |
| 102 | |
| 103 | if ( is_object( $loaded_language ) && 'WP_Error' === get_class( $loaded_language ) ) |
| 104 | wp_die($loaded_language); |
| 105 | |
| 106 | if ( $loaded_language ) |
103 | 107 | wp_install_load_language( $loaded_language ); |
104 | | } |
105 | 108 | } |
106 | 109 | |
107 | 110 | setup_config_display_header(); |