Make WordPress Core

Opened 2 years ago

Last modified 4 weeks ago

#56234 new defect (bug)

error logged messages should not be translateable

Reported by: malthert's profile malthert Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: I18N Keywords: 2nd-opinion close
Focuses: Cc:

Description (last modified by sabernhardt)

e.g. _doing_it_wrong,...

  • general consensus for software is that errors in logs should always be in English
  • these errors will only show with WP_DEBUG enabled, therefore a development errors and developers who work with WP have to speak English, otherwise wouldn't be able to understand the code in the first place
  • even if you are not a developer but use WP_DEBUG, these are not issues you can fix yourself. You need to get in touch with your hoster, your developer, the plugin developer from where this error is from or even WP core. This is much easier if the error is in English and you can google it easily. Furthermore it's much easier to only receive these errors in English for the support who you contact - rather than in the 50 different supported languages by WP.
  • many (most?) plugins do not pass a translatable strings to these, which means you end up with a language mix-mash
  • when using a multi-lingual site, we (= the admin) get the error in all kinds of languages, we do not even speak (since the translations were created by contracted agencies). Making it unnecessarily hard to track down the exact English text, so we can check it in code.

In some instances where these may be used translation may not be loaded yet (which is why we have a function_exists( '__' ) check), which means that in some cases you end up with english errors anyway.

The sensible thing to do is, to remove translations from error logged things all together.
I'm happy to provide a PR.

Related #53125 (and ticket:56198#comment:6 which made me open this ticket finally)

Change History (16)

#1 @malthert
2 years ago

@SergeyBiryukov your input is appreciated :-)

#2 @audrasjb
2 years ago

  • Keywords 2nd-opinion added

I'm fairly against this, because error message are part of the interface. As a Core developer and a GTE, I can't see why they shouldn't be accessible to non-english speakers.

At the very least, if we decide to make those message untranslatable, then they should indicate that there is a language change by wrapping the message in a container with a lang="en" attribute, to indicate to screen readers that there is an unexpected language change.

#3 @sabernhardt
2 years ago

  • Component changed from General to I18N
  • Description modified (diff)

#4 @malthert
2 years ago

If you do not understand English, there is nothing you can do with these (_doing_it_wrong,...) errors, since they require someone/a developer who understands English to have them fixed (since the WP code is in English)

In fact, having those in your own language make them less accessible: if you Google the error it may not come up with any result in your own language. If you Google the error in English, there most likely is already someone else who had this error and therefore you will be able to fix it much more easily.

Additionally, any hosting support/developer is able to help you more quickly, because they don't have to find what this error means, find the matching English error in WP core and then start fixing it - this is what I gathered from speaking to our own customer support team.

#5 @audrasjb
2 years ago

I'd kindly disagree :)

Let's take register_nav_menus(), for example.
It throws the following _doing_it_wrong message:

_doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' );

I don't see any point in not translating this message. It is a simple, clear, message and it makes sense when it's translated. Why shouldn't we translate this? It doesn’t contain any code at all.

#6 @audrasjb
2 years ago

Also:

If you do not understand English, there is nothing you can do with these (_doing_it_wrong,...) errors, since they require someone/a developer who understands English to have them fixed (since the WP code is in English)

While it may kinda be true for experimented developers, don't forget that most of people writing code for their WordPress site are not experimented developers nor agencies: they are are mostly people writing code just because they are curious about how to put together their own personal website by themselves.

Sending error messages in their own language is something truly useful.

#7 follow-up: @audrasjb
2 years ago

Another thing we should take into account: some Locales started to translate the WordPress Documentation. So "googling" any error message in these languages may start to provide some meaningful results.

However, I don't see any problem with the fact that some Locales would decide to not translate those strings. This decision is up to Locale Managers and/or General Translation Editors, not us (core developers).

I think we have to make these strings translatable so each Locale can choose the best option.

Last edited 2 years ago by audrasjb (previous) (diff)

#8 in reply to: ↑ 7 ; follow-up: @malthert
2 years ago

Replying to audrasjb:

Let's take register_nav_menus(), for example.
It throws the following _doing_it_wrong message:

_doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' );

I don't see any point in not translating this message. It is a simple, clear, message and it makes sense when it's translated. Why shouldn't we translate this? It doesn’t contain any code at all.

It's not about whether it contains code, but whether you need to be able to modify code to fix the issue. This error is a warning about a PHP type (int vs string) and the doing_it_wrong errors are not generally something laymen can fix (not even WP core can get it quite right with type juggling going on in tons of places).

Replying to audrasjb:

Also:

If you do not understand English, there is nothing you can do with these (_doing_it_wrong,...) errors, since they require someone/a developer who understands English to have them fixed (since the WP code is in English)

While it may kinda be true for experimented developers, don't forget that most of people writing code for their WordPress site are not experimented developers nor agencies: they are are mostly people writing code just because they are curious about how to put together their own personal website by themselves.

Sending error messages in their own language is something truly useful.

On the contrary - as someone who worked on tons of localized WP installs, I can guarantee you the opposite is the case.
e.g. I google the error but don't find (m)any useful results. Now the first challenge is to find the exact error text in English in WP core. Then search for the English text in Google and 99% of times find something on stackoverflow or some blog that guides me on how to fix that issue.
Not once has it been helpful, that those errors show up in my language, when I had the smallest of personal WP blogs nor when I worked for a big WC e-commerce company.
To make matters worse: when you have a multilingual installation, you may not even speak some of the languages, because the translations were ML or user contributed - now I get errors in languages I definitely won't understand.

Replying to audrasjb:

Another thing we should take into account: some Locales started to translate the WordPress Documentation. So "googling" any error message in these languages may start to provide some meaningful results.

However, I don't see any problem with the fact that some Locales would decide to not translate those strings. This decision is up to Locale Managers and/or General Translation Editors, not us (core developers).

I think we have to make these strings translatable so each Locale can choose the best option.

While that's definitely great, 95% of error resolutions for beginners come from stackoverflow,.... There's a reason why software development = copy + paste is a meme :-) And those are in English.

If we take a look at the stack required to run a WP page - none (PHP, MySQL) localize their error messages either. e.g. if you produce a notice or fatal, it will be in English.

#9 @sabernhardt
2 years ago

Error log files should be entirely in one language, if possible. I would prefer that the default is the site language, and then maybe a new constant in wp-config.php could set it to English:
define( 'WP_DEBUG_LOG_LANG', 'en' );

Many developers understand code better than English, and setting up a debug log indicates at least some degree of comfort with editing PHP.

Please share examples of WordPress errors that you have found logged in a language other than the site language (or English).

#10 @malthert
2 years ago

I would prefer that the default is the site language

Why? Every application WP relies on, ONLY logs in English (PHP, MySQL,...) - why would you suddenly want to change the logging language?
Even tools WP relies on internally (curl,...) will return an error in ENGLISH.

Please share examples of WordPress errors that you have found logged in a language other than the site language (or English).

wp_remote_get will have an English error, if the error is from CURL.
All image operations from imagick or GD will have their error in English, if the issue is in the library.

#11 in reply to: ↑ 8 @audrasjb
2 years ago

Replying to malthert:

Replying to audrasjb:

Another thing we should take into account: some Locales started to translate the WordPress Documentation. So "googling" any error message in these languages may start to provide some meaningful results.

However, I don't see any problem with the fact that some Locales would decide to not translate those strings. This decision is up to Locale Managers and/or General Translation Editors, not us (core developers).

I think we have to make these strings translatable so each Locale can choose the best option.

While that's definitely great, 95% of error resolutions for beginners come from stackoverflow,.... There's a reason why software development = copy + paste is a meme :-) And those are in English.

If we take a look at the stack required to run a WP page - none (PHP, MySQL) localize their error messages either. e.g. if you produce a notice or fatal, it will be in English.

That's definitely not enough to convince me :)

"95% of error resolutions for beginners come from stackoverflow"
While this assumption may be right, I think it would still be better to provide an error in the language of the owner of the website.

I would prefer that the default is the site language

Why? Every application WP relies on, ONLY logs in English (PHP, MySQL,...) - why would you suddenly want to change the logging language?
Even tools WP relies on internally (curl,...) will return an error in ENGLISH.

Just because others are wrong doesn't mean we have to be wrong too :)
Democratize publishing also means having a fully translated interface.

#12 follow-up: @malthert
2 years ago

Democratize publishing also means having a fully translated interface.

Which we don't have. All Mysql, PHP,... errors WP encounters are in English. And usually those are by far the majority of errors. For every 1 WP error (doing_it_wrong,...) we see in our or our customers logs, we see about 800 unique JS & PHP errors.
Would be interesting to get input on this from the big WP hosting companies.

Additionally, with more pages being multilingual (thanks to AI translation, WPML,... and the plans of WP to add multilingual content in the future), it means that the error can often be in a language the developer doesn't even understand.

What would convinve you? Have you worked with anybody who isn't native English speaking and uses WP? What's their opinion on it?

#13 in reply to: ↑ 12 @audrasjb
2 years ago

Replying to malthert:

What would convinve you? Have you worked with anybody who isn't native English speaking and uses WP? What's their opinion on it?

I thought it was clear with my poor english that I'm not a native English speaker 😅

I'm French, and what I'm sharing is the point of view of both a fr_FR Locale GTE, a developer, and somebody who works on a bunch of global company websites, with multilingual multisites.

By the way, we are also building this CMS for the average person trying to build their website and to understand what's going on when they have an issue with WP. I'll repeat myself but I think it's better to localize error message so each WordPress Locale can document those errors in their own languages on their own support forums or docs 🌐 🙂

#14 @SergeyBiryukov
2 years ago

Related/duplicate: #56551

#15 @swissspidy
19 months ago

  • Keywords close added

While it may kinda be true for experienced developers, don't forget that most of people writing code for their WordPress site are not experienced developers nor agencies: they are are mostly people writing code just because they are curious about how to put together their own personal website by themselves.
Sending error messages in their own language is something truly useful.

I wholeheartedly agree with this. When I started working with WordPress, translated error messages were very helpful for me as a non-native speaker. From very early on, WordPress has been available in many languages. It's part of its success and well aligned with its mission to democratize publishing.

In my opinion, not translating error messages does not align with this mission as it will actually cause more difficulties for some people.

#16 @swissspidy
4 weeks ago

#56551 was marked as a duplicate.

Note: See TracTickets for help on using tickets.