WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#53125 new defect (bug)

Error messages should not be translateable

Reported by: malthert Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Database Keywords: 2nd-opinion
Focuses: Cc:

Description

e.g. wp-db.php has an error message:

$error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query );

Since this is error logged, we will end up with 5 different languages of this string in error log, when using multilingual websites.
General consensus for software is that errors in logs should always be in English. (unlike errors displayed to the user).

Since %1$s and %2$s in this string are in English (since mysql always returns errors in English), we end up with a language mish-mash.

Change History (2)

#1 @SergeyBiryukov
5 months ago

  • Component changed from General to Database
  • Keywords 2nd-opinion added

Thanks for the ticket!

General consensus for software is that errors in logs should always be in English. (unlike errors displayed to the user).

Just noting that this message can also be displayed to the user, depending on the $show_errors property value, e.g. when WP_DEBUG and WP_DEBUG_DISPLAY are both true. That said, this does appear to be the only translatable message in core that is logged regardless of the WP_DEBUG_LOG value.

I can see the point of having the message be consistently logged in English, but that would be inconsistent with pretty much any other error message in WordPress, they are generally all translated for better user experience.

#2 @malthert
5 months ago

Then perhaps we just add a condition for the case where it is logged to error log, so it will be a non-translated string in that case?

Note: See TracTickets for help on using tickets.