From 34bf81970ebe5e3eea703d87ba44a64a94208b46 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 4 Sep 2014 14:39:15 +0000 Subject: [PATCH] i18n: Skip language chooser for localized packages. Also fixes the install.php welcome string, which was not bring printed. fixes #29487. Built from https://develop.svn.wordpress.org/trunk@29705 git-svn-id: http://core.svn.wordpress.org/trunk@29479 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/install.php | 18 ++++++++++-------- wp-admin/setup-config.php | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/wp-admin/install.php b/wp-admin/install.php index 8509eeaf3a..72916e4be8 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -181,15 +181,17 @@ if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { die( '

' . __( 'Configuration Error' ) . '

' . __( 'Your wp-config.php file has an empty database table prefix, which is not supported.' ) . '

' ); } -$langugage = ''; +$language = ''; if ( ! empty( $_REQUEST['language'] ) ) { - $langugage = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] ); + $language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] ); +} elseif ( isset( $GLOBALS['wp_local_package'] ) ) { + $language = $GLOBALS['wp_local_package']; } switch($step) { case 0: // Step 0 - if ( wp_can_install_language_pack() && empty( $langugage ) && ( $languages = wp_get_available_translations() ) ) { + if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { display_header( 'language-chooser' ); echo '
'; wp_install_language_form( $languages ); @@ -200,8 +202,8 @@ switch($step) { // Deliberately fall through if we can't reach the translations API. case 1: // Step 1, direct link or from language chooser. - if ( ! empty( $langugage ) ) { - $loaded_language = wp_download_language_pack( $langugage ); + if ( ! empty( $language ) ) { + $loaded_language = wp_download_language_pack( $language ); if ( $loaded_language ) { load_default_textdomain( $loaded_language ); $GLOBALS['wp_locale'] = new WP_Locale(); @@ -211,7 +213,7 @@ switch($step) { display_header(); ?>

-

+

@@ -220,8 +222,8 @@ switch($step) { display_setup_form(); break; case 2: - if ( ! empty( $langugage ) && load_default_textdomain( $langugage ) ) { - $loaded_language = $langugage; + if ( ! empty( $language ) && load_default_textdomain( $language ) ) { + $loaded_language = $language; $GLOBALS['wp_locale'] = new WP_Locale(); } else { $loaded_language = 'en_US'; diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 750b8b779a..c6f98f1ffc 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -90,7 +90,10 @@ function setup_config_display_header( $body_classes = array() ) { $language = ''; if ( ! empty( $_REQUEST['language'] ) ) { $language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] ); +} elseif ( isset( $GLOBALS['wp_local_package'] ) ) { + $language = $GLOBALS['wp_local_package']; } + switch($step) { case -1: if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {