From 4d76ce25218a32914b7d0b60af65f690ef6debee Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 5 Sep 2015 20:47:24 +0000 Subject: [PATCH] Implement a language chooser on the Network Admin -> Sites -> Add New screen. Props DrewAPicture Fixes #33528 Built from https://develop.svn.wordpress.org/trunk@33920 git-svn-id: http://core.svn.wordpress.org/trunk@33889 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/network/site-new.php | 46 ++++++++++++++++++++++++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/wp-admin/network/site-new.php b/wp-admin/network/site-new.php index 8dec36cf02..4d8d4443c1 100644 --- a/wp-admin/network/site-new.php +++ b/wp-admin/network/site-new.php @@ -10,6 +10,9 @@ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); +/** WordPress Translation Install API */ +require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); + if ( ! is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); @@ -51,6 +54,18 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { $title = $blog['title']; + $meta = array( + 'public' => 1 + ); + + // Handle translation install for the new site. + if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { + $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); + if ( $language ) { + $meta['WPLANG'] = $language; + } + } + if ( empty( $domain ) ) wp_die( __( 'Missing or invalid site address.' ) ); @@ -83,7 +98,7 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { } $wpdb->hide_errors(); - $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); + $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, $current_site->id ); $wpdb->show_errors(); if ( ! is_wp_error( $id ) ) { if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) { @@ -155,6 +170,35 @@ if ( ! empty( $messages ) ) { + + + + + 'WPLANG', + 'id' => 'site-language', + 'selected' => $lang, + 'languages' => $languages, + 'translations' => $translations, + 'show_available_translations' => wp_can_install_language_pack(), + ) ); + ?> + + + diff --git a/wp-includes/version.php b/wp-includes/version.php index 0886c8a209..6585bec7d6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33919'; +$wp_version = '4.4-alpha-33920'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.