#53125 closed defect (bug) (fixed)
Logged error messages should not be translateable
Reported by: | malthert | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Database | Keywords: | 2nd-opinion has-patch |
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 (9)
#1
follow-up:
↓ 6
@
4 years ago
- Component changed from General to Database
- Keywords 2nd-opinion added
#2
@
4 years 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?
#3
@
2 years ago
Well, if you are using logging (and are able to fix this DB issue), you have some IT knowledge and will be somewhat proficient in English. Thus it makes sense to have this error message in English.
Even if you are not proficient in English (and therefore no IT knowledge): this is an issue you cannot fix yourself - therefore you open a support ticket with your hoster. It's much easier for them to have error messages in English, than in 50 languages.
Even though this could theoretically be displayed to the user, this error only makes sense in English - as it's less actionable when it's translated.
This ticket was mentioned in PR #2812 on WordPress/wordpress-develop by kkmuffme.
2 years ago
#4
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/53125
#5
@
2 years ago
- Milestone changed from Awaiting Review to 6.1
- Summary changed from Error messages should not be translateable to Logged error messages should not be translateable
#6
in reply to:
↑ 1
@
2 years ago
Replying to SergeyBiryukov:
Just noting that this message can also be displayed to the user, depending on the
$show_errors
property value, e.g. whenWP_DEBUG
andWP_DEBUG_DISPLAY
are both true.
It looks like this comment was not entirely correct, as the message displayed to the user here is not the same as the one that is logged.
The PR should be good to go. One minor adjustment I would make is that wp_load_translations_early()
can now be called later, only if $this->show_errors
is true. This can be addressed on commit.
#7
@
2 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 53505:
SergeyBiryukov commented on PR #2812:
2 years ago
#8
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/53505.
Thanks for the ticket!
Just noting that this message can also be displayed to the user, depending on the
$show_errors
property value, e.g. whenWP_DEBUG
andWP_DEBUG_DISPLAY
are both true. That said, this does appear to be the only translatable message in core that is logged regardless of theWP_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.