]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/translation-install.php
WordPress 4.5-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / translation-install.php
index f3cc370ac427b485dd24a1b6eac7566c8f7fdf39..2056838f003621004a1bd141ae2f0605a617be44 100644 (file)
@@ -94,7 +94,7 @@ function translations_api( $type, $args = null ) {
  *               in an error, an empty array will be returned.
  */
 function wp_get_available_translations() {
-       if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
+       if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
                return $translations;
        }
 
@@ -124,6 +124,8 @@ function wp_get_available_translations() {
  *
  * @since 4.0.0
  *
+ * @global string $wp_local_package
+ *
  * @param array $languages Array of available languages (populated via the Translation API).
  */
 function wp_install_language_form( $languages ) {
@@ -141,7 +143,7 @@ function wp_install_language_form( $languages ) {
                        $language = $languages[ $wp_local_package ];
                        printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
                                esc_attr( $language['language'] ),
-                               esc_attr( $language['iso'][1] ),
+                               esc_attr( current( $language['iso'] ) ),
                                esc_attr( $language['strings']['continue'] ),
                                in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
                                esc_html( $language['native_name'] ) );
@@ -153,7 +155,7 @@ function wp_install_language_form( $languages ) {
        foreach ( $languages as $language ) {
                printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
                        esc_attr( $language['language'] ),
-                       esc_attr( $language['iso'][1] ),
+                       esc_attr( current( $language['iso'] ) ),
                        esc_attr( $language['strings']['continue'] ),
                        in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
                        esc_html( $language['native_name'] ) );
@@ -229,6 +231,7 @@ function wp_can_install_language_pack() {
        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
        $skin = new Automatic_Upgrader_Skin;
        $upgrader = new Language_Pack_Upgrader( $skin );
+       $upgrader->init();
 
        $check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );