Make WordPress Core

Changeset 53505


Ignore:
Timestamp:
06/15/2022 10:34:07 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Database: Don't translate the "WordPress database error" message in the error log.

When using multilingual websites, this string could end up with multiple different translations in the error log, making it less actionable.

Unlike errors displayed to the user, a general consensus for software is that errors in logs should always be in English. Since MySQL errors are also returned in English, this brings more consistency to the logs.

Follow-up to [6391], [8168], [19760].

Props malthert.
Fixes #53125.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r53462 r53505  
    15691569        }
    15701570
    1571         wp_load_translations_early();
    1572 
    15731571        $caller = $this->get_caller();
    15741572        if ( $caller ) {
    1575             /* translators: 1: Database error message, 2: SQL query, 3: Name of the calling function. */
    1576             $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller );
     1573            // Not translated, as this will only appear in the error log.
     1574            $error_str = sprintf( 'WordPress database error %1$s for query %2$s made by %3$s', $str, $this->last_query, $caller );
    15771575        } else {
    1578             /* translators: 1: Database error message, 2: SQL query. */
    1579             $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query );
     1576            $error_str = sprintf( 'WordPress database error %1$s for query %2$s', $str, $this->last_query );
    15801577        }
    15811578
     
    15861583            return false;
    15871584        }
     1585
     1586        wp_load_translations_early();
    15881587
    15891588        // If there is an error then take note of it.
Note: See TracChangeset for help on using the changeset viewer.