From 9db82ab3a77557fc4e04ea17875af4860559cc66 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Tue, 30 Jun 2015 19:59:28 +0000 Subject: [PATCH] wpdb: Make "WordPress database error:" translatable. props jrf. see #32021. git-svn-id: https://develop.svn.wordpress.org/trunk@33006 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 83cdafa641..42792a4d78 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -1295,19 +1295,29 @@ class wpdb { // If there is an error then take note of it if ( is_multisite() ) { - $msg = "WordPress database error: [$str]\n{$this->last_query}\n"; - if ( defined( 'ERRORLOGFILE' ) ) + $msg = sprintf( + "%s [%s]\n%s\n", + __( 'WordPress database error:' ), + $str, + $this->last_query + ); + + if ( defined( 'ERRORLOGFILE' ) ) { error_log( $msg, 3, ERRORLOGFILE ); - if ( defined( 'DIEONDBERROR' ) ) + } + if ( defined( 'DIEONDBERROR' ) ) { wp_die( $msg ); + } } else { $str = htmlspecialchars( $str, ENT_QUOTES ); $query = htmlspecialchars( $this->last_query, ENT_QUOTES ); - print "
-

WordPress database error: [$str]
- $query

-
"; + printf( + '

%s [%s]
%s

', + __( 'WordPress database error:' ), + $str, + $query + ); } }