<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29006] trunk/src/wp-admin: Bring the language chooser to setup-config.php.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29006">29006</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-07-05 05:13:05 +0000 (Sat, 05 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Bring the language chooser to setup-config.php.

see <a href="http://core.trac.wordpress.org/ticket/28577">#28577</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesupgradephp">trunk/src/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunksrcwpadmininstallphp">trunk/src/wp-admin/install.php</a></li>
<li><a href="#trunksrcwpadminsetupconfigphp">trunk/src/wp-admin/setup-config.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/upgrade.php (29005 => 29006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/upgrade.php  2014-07-05 02:12:47 UTC (rev 29005)
+++ trunk/src/wp-admin/includes/upgrade.php     2014-07-05 05:13:05 UTC (rev 29006)
</span><span class="lines">@@ -2158,3 +2158,108 @@
</span><span class="cx">  dbDelta( $ms_queries );
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><ins>+
+function wp_install_language_form( $body ) {
+       echo "<fieldset>\n";
+       echo "<legend class='screen-reader-text'>Select a default language</legend>\n";
+       echo '<input type="radio" checked="checked" class="screen-reader-input" name="language" id="language_default" value="">';
+       echo '<label for="language_default">English (United States)</label>';
+       echo "\n";
+
+       if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && ( 'en_US' !== WPLANG ) ) {
+               if ( isset( $body['languages'][WPLANG] ) ) {
+                       $language = $body['languages'][WPLANG];
+                       echo '<input type="radio" name="language" checked="checked" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_wplang" value="' . esc_attr( $language['language'] ) . '">';
+                       echo '<label for="language_wplang">' . esc_html( $language['native_name'] ) . "</label>\n";
+               }
+       }
+
+       foreach ( $body['languages'] as $language ) {
+               echo '<input type="radio" name="language" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_'. esc_attr( $language['language'] ) .'" value="' . esc_attr( $language['language'] ) . '">';
+               echo '<label for="language_' . esc_attr( $language['language'] ) . '">' . esc_html( $language['native_name'] ) . "</label>\n";
+       }
+       echo "</fieldset>\n";
+       echo '<p class="step"><input type="submit" class="button button-primary button-hero" value="&raquo;" /></p>';
+}
+
+/**
+ * @todo rename, move
+ */
+function wp_get_available_translations() {
+       $url = 'http://api.wordpress.org/translations/core/1.0/';
+       if ( wp_http_supports( array( 'ssl' ) ) ) {
+               $url = set_url_scheme( $url, 'https' );
+       }
+
+       $options = array(
+               'timeout' => 3,
+               'body' => array( 'version' => $GLOBALS['wp_version'] ),
+       );
+
+       $response = wp_remote_post( $url, $options );
+       $body = wp_remote_retrieve_body( $response );
+       if ( $body && $body = json_decode( $body, true ) ) {
+               $languages = array();
+               // Key the language array with the language code
+               foreach ( $body['languages'] as $language ) {
+                       $languages[$language['language']] = $language;
+               }
+               $body['languages'] = $languages;
+               return $body;
+       }
+       return false;
+}
+
+function wp_install_download_language_pack( $language ) {
+       // Check if the language is already installed.
+       $available_languages = get_available_languages();
+       if ( in_array( $language->language, $available_languages ) ) {
+               return $language->language;
+       }
+
+       // Confirm the language is one we can download.
+       $body = wp_get_available_translations();
+       $loading_language = false;
+       if ( $body ) {
+               foreach ( $body['languages'] as $language ) {
+                       if ( $language['language'] === $_REQUEST['language'] ) {
+                               $loading_language = $_REQUEST['language'];
+                               break;
+                       }
+               }
+       }
+
+       if ( ! $loading_language ) {
+               return false;
+       }
+       $language = (object) $language;
+
+       require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+       $skin = new Automatic_Upgrader_Skin;
+       $upgrader = new Language_Pack_Upgrader( $skin );
+       $options = array( 'clear_update_cache' => false );
+       $language->type = 'core';
+       /**
+        * @todo failures (such as non-direct FS)
+        */
+       $upgrader->upgrade( $language, array( 'clear_update_cache' => false ) );
+       return $language->language;
+}
+
+function wp_install_load_language( $request ) {
+       $loading_language = '';
+       if ( ! empty( $request ) ) {
+               $available_languages = get_available_languages();
+               if ( in_array( $request, $available_languages ) ) {
+                       $loading_language = $request;
+               }
+       }
+
+       if ( $loading_language ) {
+               load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" );
+               load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" );
+               return $loading_language;
+       }
+
+       return false;
+}
</ins></span></pre></div>
<a id="trunksrcwpadmininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/install.php (29005 => 29006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/install.php   2014-07-05 02:12:47 UTC (rev 29005)
+++ trunk/src/wp-admin/install.php      2014-07-05 05:13:05 UTC (rev 29006)
</span><span class="lines">@@ -44,34 +44,6 @@
</span><span class="cx"> $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * @todo rename, move
- */
-function wp_get_available_translations() {
-       $url = 'http://api.wordpress.org/translations/core/1.0/';
-       if ( wp_http_supports( array( 'ssl' ) ) ) {
-               $url = set_url_scheme( $url, 'https' );
-       }
-
-       $options = array(
-               'timeout' => 3,
-               'body' => array( 'version' => $GLOBALS['wp_version'] ),
-       );
-
-       $response = wp_remote_post( $url, $options );
-       $body = wp_remote_retrieve_body( $response );
-       if ( $body && $body = json_decode( $body, true ) ) {
-               $languages = array();
-               // Key the language array with the language code
-               foreach ( $body['languages'] as $language ) {
-                       $languages[$language['language']] = $language;
-               }
-               $body['languages'] = $languages;
-               return $body;
-       }
-       return false;
-}
-
-/**
</del><span class="cx">  * Display install header.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="lines">@@ -171,7 +143,7 @@
</span><span class="cx">          </tr>
</span><span class="cx">  </table>
</span><span class="cx">  <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button button-large" /></p>
</span><del>-       <input type="hidden" name="language" value="<?php echo isset( $_POST['language'] ) ? esc_attr( $_POST['language'] ) : ''; ?>" />
</del><ins>+        <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
</ins><span class="cx"> </form>
</span><span class="cx"> <?php
</span><span class="cx"> } // end display_setup_form()
</span><span class="lines">@@ -206,61 +178,23 @@
</span><span class="cx"> 
</span><span class="cx"> switch($step) {
</span><span class="cx">  case 0: // Step 0
</span><del>-               $body = wp_get_available_translations();
-               if ( $body ) {
</del><ins>+
+               if ( empty( $_GET['language'] ) && ( $body = wp_get_available_translations() ) ) {
</ins><span class="cx">                   display_header( 'language-chooser' );
</span><del>-                       echo '<form id="setup" method="post" action="install.php?step=1">';
-                       echo "<fieldset>\n";
-                       echo "<legend class='screen-reader-text'>Select a default language</legend>\n";
-                       echo '<input type="radio" checked="checked" class="screen-reader-input" name="language" id="language_default" value="">';
-                       echo '<label for="language_default">English (United States)</label>';
-                       echo "\n";
-
-                       if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && ( 'en_US' !== WPLANG ) ) {
-                               if ( isset( $body['languages'][WPLANG] ) ) {
-                                       $language = $body['languages'][WPLANG];
-                                       echo '<input type="radio" name="language" checked="checked" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_wplang" value="' . esc_attr( $language['language'] ) . '">';
-                                       echo '<label for="language_wplang">' . esc_html( $language['native_name'] ) . "</label>\n";
-                               }
-                       }
-
-                       foreach ( $body['languages'] as $language ) {
-                               echo '<input type="radio" name="language" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_'. esc_attr( $language['language'] ) .'" value="' . esc_attr( $language['language'] ) . '">';
-                               echo '<label for="language_' . esc_attr( $language['language'] ) . '">' . esc_html( $language['native_name'] ) . "</label>\n";
-                       }
-                       echo "</fieldset>\n";
-                       echo '<p class="step"><input type="submit" class="button button-primary button-hero" value="&raquo;" /></p>';
</del><ins>+                        echo '<form id="setup" method="post" action="?step=1">';
+                       wp_install_language_form( $body );
</ins><span class="cx">                   echo '</form>';
</span><span class="cx">                  break;
</span><span class="cx">          }
</span><ins>+
</ins><span class="cx">           // Deliberately fall through if we can't reach the translations API.
</span><span class="cx"> 
</span><span class="cx">  case 1: // Step 1, direct link or from language chooser.
</span><del>-               if ( ! empty( $_POST['language'] ) ) {
-                       $body = wp_get_available_translations();
-                       $loading_language = false;
-                       if ( $body ) {
-                               foreach ( $body['languages'] as $language ) {
-                                       if ( $language['language'] === $_POST['language'] ) {
-                                               $loading_language = $_POST['language'];
-                                               break;
-                                       }
-                               }
</del><ins>+                if ( ! empty( $_REQUEST['language'] ) ) {
+                       $loaded_language = wp_install_download_language_pack( $_REQUEST['language'] );
+                       if ( $loaded_language ) {
+                               wp_install_load_language( $loaded_language );
</ins><span class="cx">                   }
</span><del>-                       if ( ! empty( $loading_language ) ) {
-                               require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
-                               $skin = new Automatic_Upgrader_Skin;
-                               $upgrader = new Language_Pack_Upgrader( $skin );
-                               $options = array( 'clear_update_cache' => false );
-                               $language['type'] = 'core';
-                               $language = (object) $language;
-                               /**
-                                * @todo failures (such as non-direct FS)
-                                */
-                               $upgrader->upgrade( $language, array( 'clear_update_cache' => false ) );
-                               load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" );
-                               load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" );
-                       }
</del><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          display_header();
</span><span class="lines">@@ -275,15 +209,7 @@
</span><span class="cx">          display_setup_form();
</span><span class="cx">          break;
</span><span class="cx">  case 2:
</span><del>-               $loading_language = '';
-               if ( ! empty( $_POST['language'] ) ) {
-                       $available_languages = get_available_languages();
-                       if ( in_array( $_POST['language'], $available_languages ) ) {
-                               $loading_language = $_POST['language'];
-                               load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" );
-                               load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" );
-                       }
-               }
</del><ins>+                $loaded_language = wp_install_load_language( $_REQUEST['language'] );
</ins><span class="cx"> 
</span><span class="cx">          if ( ! empty( $wpdb->error ) )
</span><span class="cx">                  wp_die( $wpdb->error->get_error_message() );
</span><span class="lines">@@ -321,7 +247,7 @@
</span><span class="cx"> 
</span><span class="cx">          if ( $error === false ) {
</span><span class="cx">                  $wpdb->show_errors();
</span><del>-                       $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loading_language );
</del><ins>+                        $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
</ins><span class="cx"> ?>
</span><span class="cx"> 
</span><span class="cx"> <h1><?php _e( 'Success!' ); ?></h1>
</span></span></pre></div>
<a id="trunksrcwpadminsetupconfigphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/setup-config.php (29005 => 29006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/setup-config.php      2014-07-05 02:12:47 UTC (rev 29005)
+++ trunk/src/wp-admin/setup-config.php 2014-07-05 05:13:05 UTC (rev 29006)
</span><span class="lines">@@ -26,12 +26,14 @@
</span><span class="cx">  *
</span><span class="cx">  * Set this to error_reporting( -1 ) for debugging
</span><span class="cx">  */
</span><del>-error_reporting(-1);
</del><ins>+error_reporting(0);
</ins><span class="cx"> 
</span><span class="cx"> define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
</span><span class="cx"> 
</span><span class="cx"> require( ABSPATH . 'wp-settings.php' );
</span><span class="cx"> 
</span><ins>+require( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
</ins><span class="cx"> // Support wp-config-sample.php one level up, for the develop repo.
</span><span class="cx"> if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
</span><span class="cx">  $config_file = file( ABSPATH . 'wp-config-sample.php' );
</span><span class="lines">@@ -48,7 +50,7 @@
</span><span class="cx"> if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) )
</span><span class="cx">  wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' );
</span><span class="cx"> 
</span><del>-$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
</del><ins>+$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Display setup wp-config.php file header.
</span><span class="lines">@@ -56,8 +58,13 @@
</span><span class="cx">  * @ignore
</span><span class="cx">  * @since 2.3.0
</span><span class="cx">  */
</span><del>-function setup_config_display_header() {
</del><ins>+function setup_config_display_header( $body_classes = array() ) {
</ins><span class="cx">   global $wp_version;
</span><ins>+       $body_classes = (array) $body_classes;
+       $body_classes[] = 'wp-core-ui';
+       if ( is_rtl() ) {
+               $body_classes[] = 'rtl';
+       }
</ins><span class="cx"> 
</span><span class="cx">  header( 'Content-Type: text/html; charset=utf-8' );
</span><span class="cx"> ?>
</span><span class="lines">@@ -71,14 +78,40 @@
</span><span class="cx"> <link rel="stylesheet" href="../<?php echo WPINC ?>/css/buttons.css?ver=<?php echo preg_replace( '/[^0-9a-z\.-]/i', '', $wp_version ); ?>" type="text/css" />
</span><span class="cx"> 
</span><span class="cx"> </head>
</span><del>-<body class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>">
</del><ins>+<body class="<?php echo implode( ' ', $body_classes ); ?>">
</ins><span class="cx"> <h1 id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
</span><span class="cx"> <?php
</span><span class="cx"> } // end function setup_config_display_header();
</span><span class="cx"> 
</span><span class="cx"> switch($step) {
</span><ins>+       case -1:
+
+               if ( empty( $_GET['language'] ) && ( $body = wp_get_available_translations() ) ) {
+                       setup_config_display_header( 'language-chooser' );
+                       echo '<form id="setup" method="post" action="?step=0">';
+                       wp_install_language_form( $body );
+                       echo '</form>';
+                       break;
+               }
+
+               // Deliberately fall through if we can't reach the translations API.
+
</ins><span class="cx">   case 0:
</span><ins>+               if ( ! empty( $_REQUEST['language'] ) ) {
+                       $loaded_language = wp_install_download_language_pack( $_REQUEST['language'] );
+                       if ( $loaded_language ) {
+                               wp_install_load_language( $loaded_language );
+                       }
+               }
+
</ins><span class="cx">           setup_config_display_header();
</span><ins>+               $step_1 = 'setup-config.php?step=1';
+               if ( isset( $_REQUEST['noapi'] ) ) {
+                       $step_1 .= '&amp;noapi';
+               }
+               if ( ! empty( $loaded_language ) ) {
+                       $step_1 .= '&amp;language=' . $loaded_language;
+               }
</ins><span class="cx"> ?>
</span><span class="cx"> 
</span><span class="cx"> <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
</span><span class="lines">@@ -96,11 +129,12 @@
</span><span class="cx"> </p>
</span><span class="cx"> <p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
</span><span class="cx"> 
</span><del>-<p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
</del><ins>+<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
</ins><span class="cx"> <?php
</span><span class="cx">  break;
</span><span class="cx"> 
</span><span class="cx">  case 1:
</span><ins>+               $loaded_language = wp_install_load_language( $_REQUEST['language'] );
</ins><span class="cx">           setup_config_display_header();
</span><span class="cx">  ?>
</span><span class="cx"> <form method="post" action="setup-config.php?step=2">
</span><span class="lines">@@ -133,19 +167,30 @@
</span><span class="cx">          </tr>
</span><span class="cx">  </table>
</span><span class="cx">  <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
</span><ins>+       <input type="hidden" name="language" value="<?php echo esc_attr( $loaded_language ); ?>" />
</ins><span class="cx">   <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
</span><span class="cx"> </form>
</span><span class="cx"> <?php
</span><span class="cx">  break;
</span><span class="cx"> 
</span><span class="cx">  case 2:
</span><ins>+       $loaded_language = wp_install_load_language( $_REQUEST['language'] );
</ins><span class="cx">   $dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
</span><span class="cx">  $uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
</span><span class="cx">  $pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
</span><span class="cx">  $dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
</span><span class="cx">  $prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
</span><span class="cx"> 
</span><del>-       $tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
</del><ins>+        $step_1 = 'setup-config.php?step=1';
+       $install = 'install.php';
+       if ( isset( $_REQUEST['noapi'] ) ) {
+               $step_1 .= '&amp;noapi';
+       }
+       if ( $loaded_language ) {
+               $step_1 .= '&amp;language=' . $loaded_language;
+               $install .= '?language=' . $loaded_language;
+       }
+       $tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
</ins><span class="cx"> 
</span><span class="cx">  if ( empty( $prefix ) )
</span><span class="cx">          wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
</span><span class="lines">@@ -239,7 +284,7 @@
</span><span class="cx">          }
</span><span class="cx"> ?></textarea>
</span><span class="cx"> <p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the install.&#8221;' ); ?></p>
</span><del>-<p class="step"><a href="install.php" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
</del><ins>+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
</ins><span class="cx"> <script>
</span><span class="cx"> (function(){
</span><span class="cx"> var el=document.getElementById('wp-config');
</span><span class="lines">@@ -266,7 +311,7 @@
</span><span class="cx"> ?>
</span><span class="cx"> <p><?php _e( "All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p>
</span><span class="cx"> 
</span><del>-<p class="step"><a href="install.php" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
</del><ins>+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
</ins><span class="cx"> <?php
</span><span class="cx">  endif;
</span><span class="cx">  break;
</span></span></pre>
</div>
</div>

</body>
</html>