Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.