Make WordPress Core

Changeset 19760


Ignore:
Timestamp:
01/26/2012 08:34:27 PM (13 years ago)
Author:
nacin
Message:

Introduce wp_load_translations_early(), which can be used before the locale is properly loaded in order to translate early error strings. Internationalize setup-config.php -- translators no longer have a reason to modify this file. fixes #18180.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/setup-config.php

    r19701 r19760  
    4242/**#@-*/
    4343
    44 require_once(ABSPATH . WPINC . '/load.php');
    45 require_once(ABSPATH . WPINC . '/version.php');
     44require(ABSPATH . WPINC . '/load.php');
     45require(ABSPATH . WPINC . '/version.php');
     46
     47// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
     48wp_load_translations_early();
     49
    4650wp_check_php_mysql_versions();
    4751
    4852require_once(ABSPATH . WPINC . '/compat.php');
    49 require_once(ABSPATH . WPINC . '/functions.php');
    5053require_once(ABSPATH . WPINC . '/class-wp-error.php');
    5154
    52 if (!file_exists(ABSPATH . 'wp-config-sample.php'))
    53     wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
     55if ( ! file_exists( ABSPATH . 'wp-config-sample.php' ) )
     56    wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) );
    5457
    5558$config_file = file(ABSPATH . 'wp-config-sample.php');
    5659
    5760// Check if wp-config.php has been created
    58 if (file_exists(ABSPATH . 'wp-config.php'))
    59     wp_die("<p>The file 'wp-config.php' already exists. 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>.</p>");
     61if ( file_exists( ABSPATH . 'wp-config.php' ) )
     62    wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' );
    6063
    6164// Check if wp-config.php exists above the root directory but is not part of another install
    62 if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php'))
    63     wp_die("<p>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>.</p>");
    64 
    65 if (isset($_GET['step']))
    66     $step = $_GET['step'];
    67 else
    68     $step = 0;
     65if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) )
     66    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>' );
     67
     68$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
    6969
    7070/**
     
    8383<head>
    8484<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    85 <title>WordPress &rsaquo; Setup Configuration File</title>
     85<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
    8686<link rel="stylesheet" href="css/install.css" type="text/css" />
    8787
     
    9797?>
    9898
    99 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
     99<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>
    100100<ol>
    101     <li>Database name</li>
    102     <li>Database username</li>
    103     <li>Database password</li>
    104     <li>Database host</li>
    105     <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
     101    <li><?php _e( 'Database name' ); ?></li>
     102    <li><?php _e( 'Database username' ); ?></li>
     103    <li><?php _e( 'Database password' ); ?></li>
     104    <li><?php _e( 'Database host' ); ?></li>
     105    <li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
    106106</ol>
    107 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
    108 <p>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>
    109 
    110 <p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button">Let&#8217;s go!</a></p>
     107<p><strong><?php _e( "If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
     108<p>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>
     109
     110<p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
    111111<?php
    112112    break;
     
    116116    ?>
    117117<form method="post" action="setup-config.php?step=2">
    118     <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
     118    <p><?php _e( "Below you should enter your database connection details. If you're not sure about these, contact your host." ); ?></p>
    119119    <table class="form-table">
    120120        <tr>
    121             <th scope="row"><label for="dbname">Database Name</label></th>
     121            <th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
    122122            <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
    123             <td>The name of the database you want to run WP in. </td>
    124         </tr>
    125         <tr>
    126             <th scope="row"><label for="uname">User Name</label></th>
    127             <td><input name="uname" id="uname" type="text" size="25" value="username" /></td>
    128             <td>Your MySQL username</td>
    129         </tr>
    130         <tr>
    131             <th scope="row"><label for="pwd">Password</label></th>
    132             <td><input name="pwd" id="pwd" type="text" size="25" value="password" /></td>
    133             <td>...and your MySQL password.</td>
    134         </tr>
    135         <tr>
    136             <th scope="row"><label for="dbhost">Database Host</label></th>
     123            <td><?php _e( 'The name of the database you want to run WP in.' ); ?></td>
     124        </tr>
     125        <tr>
     126            <th scope="row"><label for="uname"><?php _e( 'User Name' ); ?></label></th>
     127            <td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td>
     128            <td><?php _e( 'Your MySQL username' ); ?></td>
     129        </tr>
     130        <tr>
     131            <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th>
     132            <td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" /></td>
     133            <td><?php _e( '&hellip;and your MySQL password.' ); ?></td>
     134        </tr>
     135        <tr>
     136            <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
    137137            <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
    138             <td>You should be able to get this info from your web host, if <code>localhost</code> does not work.</td>
    139         </tr>
    140         <tr>
    141             <th scope="row"><label for="prefix">Table Prefix</label></th>
     138            <td><?php _e( 'You should be able to get this info from your web host, if <code>localhost</code> does not work.' ); ?></td>
     139        </tr>
     140        <tr>
     141            <th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
    142142            <td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td>
    143             <td>If you want to run multiple WordPress installations in a single database, change this.</td>
     143            <td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
    144144        </tr>
    145145    </table>
    146     <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="true" /><?php } ?>
    147     <p class="step"><input name="submit" type="submit" value="Submit" class="button" /></p>
     146    <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
     147    <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button" /></p>
    148148</form>
    149149<?php
     
    161161    // Validate $prefix: it can only contain letters, numbers and underscores
    162162    if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
    163         wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );
     163        wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' ) );
    164164
    165165    // Test the db connection.
     
    176176    require_wp_db();
    177177    if ( ! empty( $wpdb->error ) ) {
    178         $back = '<p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">Try Again</a></p>';
     178        $back = '<p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">' . __( 'Try Again' ) . '</a></p>';
    179179        wp_die( $wpdb->error->get_error_message() . $back );
    180180    }
     
    182182    // Fetch or generate keys and salts.
    183183    $no_api = isset( $_POST['noapi'] );
    184     require_once( ABSPATH . WPINC . '/plugin.php' );
    185     require_once( ABSPATH . WPINC . '/l10n.php' );
    186     require_once( ABSPATH . WPINC . '/pomo/translations.php' );
    187184    if ( ! $no_api ) {
    188185        require_once( ABSPATH . WPINC . '/class-http.php' );
     
    249246        display_header();
    250247?>
    251 <p>Sorry, but I can't write the <code>wp-config.php</code> file.</p>
    252 <p>You can create the <code>wp-config.php</code> manually and paste the following text into it.</p>
     248<p><?php _e( "Sorry, but I can't write the <code>wp-config.php</code> file." ); ?></p>
     249<p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p>
    253250<textarea cols="98" rows="15" class="code"><?php
    254251        foreach( $config_file as $line ) {
     
    256253        }
    257254?></textarea>
    258 <p>After you've done that, click "Run the install."</p>
    259 <p class="step"><a href="install.php" class="button">Run the install</a></p>
     255<p><?php _e( 'After you\'ve done that, click "Run the install."' ); ?></p>
     256<p class="step"><a href="install.php" class="button"><?php _e( 'Run the install' ); ?></a></p>
    260257<?php
    261258    else :
     
    268265        display_header();
    269266?>
    270 <p>All right sparky! You'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>
    271 
    272 <p class="step"><a href="install.php" class="button">Run the install</a></p>
     267<p><?php _e( "All right sparky! You'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>
     268
     269<p class="step"><a href="install.php" class="button"><?php _e( 'Run the install' ); ?></a></p>
    273270<?php
    274271    endif;
  • trunk/wp-includes/functions.php

    r19712 r19760  
    12021202        // One or more tables exist. We are insane.
    12031203
     1204        wp_load_translations_early();
     1205
    12041206        // Die with a DB error.
    1205         $wpdb->error = sprintf( /*WP_I18N_NO_TABLES*/'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.'/*/WP_I18N_NO_TABLES*/, 'maint/repair.php?referrer=is_blog_installed' );
     1207        $wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
    12061208        dead_db();
    12071209    }
     
    26482650    nocache_headers();
    26492651    header( 'Content-Type: text/html; charset=utf-8' );
     2652
     2653    wp_load_translations_early();
    26502654?>
    26512655<!DOCTYPE html>
     
    26532657<head>
    26542658<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    2655     <title><?php echo /*WP_I18N_DB_ERROR*/'Database Error'/*/WP_I18N_DB_ERROR*/; ?></title>
     2659    <title><?php _e( 'Database Error' ); ?></title>
    26562660
    26572661</head>
    26582662<body>
    2659     <h1><?php echo /*WP_I18N_DB_CONNECTION_ERROR*/'Error establishing a database connection'/*/WP_I18N_DB_CONNECTION_ERROR*/; ?></h1>
     2663    <h1><?php _e( 'Error establishing a database connection' ); ?></h1>
    26602664</body>
    26612665</html>
  • trunk/wp-includes/load.php

    r19712 r19760  
    2020
    2121    if ( isset( $_REQUEST['GLOBALS'] ) )
    22         die( /*WP_I18N_GLOBALS_OVERWRITE*/'GLOBALS overwrite attempt detected'/*/WP_I18N_GLOBALS_OVERWRITE*/ );
     22        die( 'GLOBALS overwrite attempt detected' );
    2323
    2424    // Variables that shouldn't be unset
     
    9898 * Dies if requirements are not met.
    9999 *
    100  * This function must be able to work without a complete environment set up. In wp-load.php, for
    101  * example, WP_CONTENT_DIR is defined and version.php is included before this function is called.
    102  *
    103100 * @access private
    104101 * @since 3.0.0
    105102 */
    106103function wp_check_php_mysql_versions() {
    107     // we can probably extend this function to check if wp_die() exists then use translated strings, and then use it in install.php etc.
    108 
    109104    global $required_php_version, $wp_version;
    110105    $php_version = phpversion();
    111     if ( version_compare( $required_php_version, $php_version, '>' ) )
    112         die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'/*/WP_I18N_OLD_PHP*/, $php_version, $wp_version, $required_php_version ) );
    113 
    114     if ( !extension_loaded( 'mysql' ) && !file_exists( WP_CONTENT_DIR . '/db.php' ) )
    115         die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
     106    if ( version_compare( $required_php_version, $php_version, '>' ) ) {
     107        wp_load_translations_early();
     108        wp_die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
     109    }
     110
     111    if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
     112        wp_load_translations_early();
     113        wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
     114    }
    116115}
    117116
     
    159158        die();
    160159    }
     160
     161    wp_load_translations_early();
    161162
    162163    $protocol = $_SERVER["SERVER_PROTOCOL"];
     
    171172    <head>
    172173    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    173         <title><?php echo /*WP_I18N_MAINTENANCE*/'Maintenance'/*/WP_I18N_MAINTENANCE*/; ?></title>
     174        <title><?php _e( 'Maintenance' ); ?></title>
    174175
    175176    </head>
    176177    <body>
    177         <h1><?php echo /*WP_I18N_MAINT_MSG*/'Briefly unavailable for scheduled maintenance. Check back in a minute.'/*/WP_I18N_MAINT_MSG*/; ?></h1>
     178        <h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
    178179    </body>
    179180    </html>
     
    365366    $prefix = $wpdb->set_prefix( $table_prefix );
    366367
    367     if ( is_wp_error( $prefix ) )
    368         wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );
     368    if ( is_wp_error( $prefix ) ) {
     369        wp_load_translations_early();
     370        wp_die( __( '<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.' ) );
     371    }
    369372}
    370373
     
    650653    return false;
    651654}
     655
     656/**
     657 * Attempts an early load of translations.
     658 *
     659 * Used for errors encountered during the initial loading process, before the locale has been
     660 * properly detected and loaded.
     661 *
     662 * Designed for unusual load sequences (like setup-config.php) or for when the script will then
     663 * terminate with an error, otherwise there is a risk that a file can be double-included.
     664 *
     665 * @since 3.4.0
     666 * @access private
     667 */
     668function wp_load_translations_early() {
     669    global $text_direction, $wp_locale;
     670
     671    static $loaded = false;
     672    if ( $loaded )
     673        return;
     674    $loaded = true;
     675
     676    if ( function_exists( 'did_action' ) && did_action( 'init' ) )
     677        return;
     678
     679    // We need $wp_local_package
     680    require ABSPATH . WPINC . '/version.php';
     681
     682    // Translation and localization
     683    require_once ABSPATH . WPINC . '/pomo/mo.php';
     684    require_once ABSPATH . WPINC . '/l10n.php';
     685    require_once ABSPATH . WPINC . '/locale.php';
     686
     687    // General libraries
     688    require_once ABSPATH . WPINC . '/functions.php';
     689    require_once ABSPATH . WPINC . '/plugin.php';
     690
     691    $locales = $locations = array();
     692
     693    while ( true ) {
     694        if ( defined( 'WPLANG' ) ) {
     695            if ( '' == WPLANG )
     696                break;
     697            $locales[] = WPLANG;
     698        }
     699
     700        if ( isset( $wp_local_package ) )
     701            $locales[] = $wp_local_package;
     702
     703        if ( ! $locales )
     704            break;
     705
     706        if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
     707            $locations[] = WP_LANG_DIR;
     708
     709        if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
     710            $locations[] = WP_CONTENT_DIR . '/languages';
     711
     712        if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
     713            $locations[] = ABSPATH . 'wp-content/languages';
     714
     715        if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
     716            $locations[] = ABSPATH . WPINC . '/languages';
     717
     718        if ( ! $locations )
     719            break;
     720
     721        $locations = array_unique( $locations );
     722
     723        foreach ( $locales as $locale ) {
     724            foreach ( $locations as $location ) {
     725                if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
     726                    load_textdomain( 'default', $location . '/' . $locale . '.mo' );
     727                    if ( WP_Locale::is_locale_rtl( $locale ) )
     728                        $text_direction = 'rtl';
     729                    break 2;
     730                }
     731            }
     732        }
     733
     734        break;
     735    }
     736
     737    $wp_locale = new WP_Locale();
     738}
  • trunk/wp-includes/locale.php

    r19755 r19760  
    8888     * Locales which are known to be right-to-left.
    8989     */
    90     private $rtl_locales = array( 'ar', 'ckb', 'fa_IR', 'he_IL', 'ug_CN', 'dv', 'fa_AF', 'ha', 'ps', 'uz_UZ', 'yi' );
     90    private static $rtl_locales = array( 'ar', 'ckb', 'fa_IR', 'he_IL', 'ug_CN', 'dv', 'fa_AF', 'ha', 'ps', 'uz_UZ', 'yi' );
    9191
    9292    /**
     
    184184
    185185        // Locale-specific tweaks
    186         if ( in_array( get_locale(), $this->rtl_locales ) )
     186        if ( self::is_locale_rtl( get_locale() ) )
    187187            $this->text_direction = 'rtl';
    188188
     
    334334    }
    335335
     336    public static function is_locale_rtl( $locale ) {
     337        return in_array( $locale, self::$rtl_locales );
     338    }
    336339}
    337340
  • trunk/wp-includes/ms-load.php

    r19712 r19760  
    212212
    213213    // Still no dice.
     214    wp_load_translations_early();
     215
    214216    if ( 1 == count( $sites ) )
    215         wp_die( sprintf( /*WP_I18N_BLOG_DOESNT_EXIST*/'That site does not exist. Please try <a href="%s">%s</a>.'/*/WP_I18N_BLOG_DOESNT_EXIST*/, $sites[0]->domain . $sites[0]->path ) );
     217        wp_die( sprintf( __( 'That site does not exist. Please try <a href="%s">%s</a>.' ), 'http://' . $sites[0]->domain . $sites[0]->path ) );
    216218    else
    217         wp_die( /*WP_I18N_NO_SITE_DEFINED*/'No site defined on this host. If you are the owner of this site, please check <a href="http://codex.wordpress.org/Debugging_a_WordPress_Network">Debugging a WordPress Network</a> for help.'/*/WP_I18N_NO_SITE_DEFINED*/ );
     219        wp_die( __( 'No site defined on this host. If you are the owner of this site, please check <a href="http://codex.wordpress.org/Debugging_a_WordPress_Network">Debugging a WordPress Network</a> for help.' ) );
    218220}
    219221
     
    229231    global $wpdb, $domain, $path;
    230232
    231     $title = /*WP_I18N_FATAL_ERROR*/'Error establishing database connection'/*/WP_I18N_FATAL_ERROR*/;
     233    wp_load_translations_early();
     234
     235    $title = __( 'Error establishing database connection' );
    232236    $msg  = '<h1>' . $title . '</h1>';
    233237    if ( ! is_admin() )
    234238        die( $msg );
    235     $msg .= '<p>' . /*WP_I18N_CONTACT_OWNER*/'If your site does not display, please contact the owner of this network.'/*/WP_I18N_CONTACT_OWNER*/ . '';
    236     $msg .= ' ' . /*WP_I18N_CHECK_MYSQL*/'If you are the owner of this network please check that MySQL is running properly and all tables are error free.'/*/WP_I18N_CHECK_MYSQL*/ . '</p>';
     239    $msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
     240    $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
    237241    if ( false && !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
    238         $msg .= '<p>' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really should look at your database now.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '</p>';
     242        $msg .= '<p>' . sprintf( __( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really should look at your database now.' ), $wpdb->site ) . '</p>';
    239243    else
    240         $msg .= '<p>' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'<strong>Could not find site <code>%1$s</code>.</strong> Searched for table <code>%2$s</code> in database <code>%3$s</code>. Is that right?'/*/WP_I18N_NO_SITE_FOUND*/, rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '</p>';
    241     $msg .= '<p><strong>' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*/WP_I18N_WHAT_DO_I_DO*/ . '</strong> ';
    242     $msg .= /*WP_I18N_RTFM*/'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_a_WordPress_Network">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'/*/WP_I18N_RTFM*/;
    243     $msg .= ' ' . /*WP_I18N_STUCK*/'If you&#8217;re still stuck with this message, then check that your database contains the following tables:'/*/WP_I18N_STUCK*/ . '</p><ul>';
     244        $msg .= '<p>' . sprintf( __( '<strong>Could not find site <code>%1$s</code>.</strong> Searched for table <code>%2$s</code> in database <code>%3$s</code>. Is that right?' ), rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '</p>';
     245    $msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
     246    $msg .= __( 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_a_WordPress_Network">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' );
     247    $msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
    244248    foreach ( $wpdb->tables('global') as $t => $table ) {
    245249        if ( 'sitecategories' == $t )
  • trunk/wp-includes/ms-settings.php

    r18568 r19760  
    3232            $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
    3333        } else {
    34             wp_die( /*WP_I18N_NO_PORT_NUMBER*/'Multisite only works without the port number in the URL.'/*/WP_I18N_NO_PORT_NUMBER*/ );
     34            wp_load_translations_early();
     35            wp_die( __( 'Multisite only works without the port number in the URL.' ) );
    3536        }
    3637    }
     
    117118            $current_blog->blog_id = $blog_id = 1;
    118119        } else {
    119             $msg = ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ? ' ' . /*WP_I18N_TABLES_MISSING*/'Database tables are missing.'/*/WP_I18N_TABLES_MISSING*/ : '';
    120             wp_die( /*WP_I18N_NO_BLOG*/'No site by that name on this system.'/*/WP_I18N_NO_BLOG*/ . $msg );
     120            wp_load_translations_early();
     121            $msg = ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ? ' ' . __( 'Database tables are missing.' ) : '';
     122            wp_die( __( 'No site by that name on this system.' ) . $msg );
    121123        }
    122124    }
  • trunk/wp-includes/wp-db.php

    r19712 r19760  
    574574
    575575        if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
    576             return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
     576            return new WP_Error('invalid_db_prefix', 'Invalid database prefix' );
    577577
    578578        $old_prefix = is_multisite() ? '' : $prefix;
     
    746746        if ( !@mysql_select_db( $db, $dbh ) ) {
    747747            $this->ready = false;
    748             $this->bail( sprintf( /*WP_I18N_DB_SELECT_DB*/'<h1>Can&#8217;t select database</h1>
     748            wp_load_translations_early();
     749            $this->bail( sprintf( __( '<h1>Can&#8217;t select database</h1>
    749750<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>%1$s</code> database.</p>
    750751<ul>
     
    753754<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
    754755</ul>
    755 <p>If you don\'t know how to set up a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser ), 'db_select_fail' );
     756<p>If you don\'t know how to set up a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>' ), $db, $this->dbuser ), 'db_select_fail' );
    756757            return;
    757758        }
     
    924925            return false;
    925926
     927        wp_load_translations_early();
     928
    926929        if ( $caller = $this->get_caller() )
    927             $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller );
     930            $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller );
    928931        else
    929             $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query );
     932            $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query );
    930933
    931934        if ( function_exists( 'error_log' )
     
    10381041
    10391042        if ( !$this->dbh ) {
    1040             $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
     1043            wp_load_translations_early();
     1044            $this->bail( sprintf( __( "
    10411045<h1>Error establishing a database connection</h1>
    10421046<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
     
    10471051</ul>
    10481052<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
    1049 "/*/WP_I18N_DB_CONN_ERROR*/, $this->dbhost ), 'db_connect_fail' );
     1053" ), $this->dbhost ), 'db_connect_fail' );
    10501054
    10511055            return;
     
    10741078
    10751079        // some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
    1076         if ( function_exists( 'apply_filters' ) )
    1077             $query = apply_filters( 'query', $query );
     1080        $query = apply_filters( 'query', $query );
    10781081
    10791082        $return_val = 0;
     
    13271330            return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
    13281331        } else {
    1329             $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);
     1332            $this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" );
    13301333        }
    13311334    }
  • trunk/wp-load.php

    r19712 r19760  
    4040    // Set a path for the link to the installer
    4141    if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false )
    42         $path = '';
     42        $path = 'setup-config.php';
    4343    else
    44         $path = 'wp-admin/';
     44        $path = 'wp-admin/setup-config.php';
    4545
    46     require_once( ABSPATH . '/wp-includes/load.php' );
    47     require_once( ABSPATH . '/wp-includes/version.php' );
     46    define( 'WPINC', 'wp-includes' );
    4847    define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    49     define( 'WPINC', 'wp-includes' );
     48    require_once( ABSPATH . WPINC . '/load.php' );
     49    require_once( ABSPATH . WPINC . '/version.php' );
     50
     51    wp_load_translations_early();
    5052    wp_check_php_mysql_versions();
    5153
    5254    // Die with an error message
    53     require_once( ABSPATH . '/wp-includes/class-wp-error.php' );
    54     require_once( ABSPATH . '/wp-includes/functions.php' );
    55     require_once( ABSPATH . '/wp-includes/plugin.php' );
    56     $text_direction = /*WP_I18N_TEXT_DIRECTION*/'ltr'/*/WP_I18N_TEXT_DIRECTION*/;
    57     wp_die(sprintf(/*WP_I18N_NO_CONFIG*/"<p>There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started.</p> <p>Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>.</p> <p>You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%ssetup-config.php' class='button'>Create a Configuration File</a></p>"/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/'WordPress &rsaquo; Error'/*/WP_I18N_ERROR_TITLE*/, array('text_direction' => $text_direction));
     55    $die  = '<p>' . __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
     56    $die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
     57    $die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
     58    $die .= '<p><a href="' . $path . '" class="button">' . __( "Create a Configuration File" ) . '</a></p>';
    5859
     60    wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
    5961}
  • trunk/wp-settings.php

    r19758 r19760  
    7171require( ABSPATH . WPINC . '/class-wp-error.php' );
    7272require( ABSPATH . WPINC . '/plugin.php' );
     73require( ABSPATH . WPINC . '/pomo/mo.php' );
    7374
    7475// Include the wpdb class and, if present, a db.php database drop-in.
     
    8283wp_start_object_cache();
    8384
    84 // Load early WordPress files.
     85// Attach the default filters.
    8586require( ABSPATH . WPINC . '/default-filters.php' );
    86 require( ABSPATH . WPINC . '/pomo/mo.php' );
    8787
    8888// Initialize multisite if enabled.
     
    101101
    102102// Load the L10n library.
    103 require( ABSPATH . WPINC . '/l10n.php' );
     103require_once( ABSPATH . WPINC . '/l10n.php' );
    104104
    105105// Run the installer if WordPress is not installed.
     
    269269
    270270// Pull in locale data after loading text domain.
    271 require( ABSPATH . WPINC . '/locale.php' );
     271require_once( ABSPATH . WPINC . '/locale.php' );
    272272
    273273/**
Note: See TracChangeset for help on using the changeset viewer.