Remove translation of exception messages

Created on 1 August 2013, almost 11 years ago
Updated 2 March 2023, over 1 year ago

Follow up for #1987602: Convert ajax_form_callback() to a new style controller β†’

Problem/Motivation

As specified in #1987602-79: Convert ajax_form_callback() to a new style controller β†’ Exception messages shouldn't be translated.

Reasons to not translate exceptions messages (from comments on this issue and #817160: Don't translate exceptions β†’ ):

  • "Additional uncaught exception while handling exception." Calling a whole huge codepath in our exception is liable to obscure the real problem in many situations.
  • Adds a dependency on common.inc everywhere we want to throw (or test) an exception. Ugggghh.
  • Exception messages are developer-facing strings, and as such, there is no real reason to translate them. As in SimpleTest, we don't need to pollute l.d.o with hundreds upon hundreds of strings no one will care about.
  • Googling for translated error messages is more difficult.
  • technical issues with ... calling t() ... [especially in the] bootstrap phase ... [and with] ... unit tests.

Proposed resolution

Remove translation of exceptions in code base.

However, it was pointed out that there are user facing exceptions, at least field errors are such., so we may have to specify when it is OK to translate exception messages or refactor these to error messages.

Coder sniff DrupalPractice.General.ExceptionT added to 8.9 in #3134731: Update coder to 8.3.9 β†’

Remaining tasks

- Update Coding standards - PHP Exceptions β†’ .
- Create a patch (or several patches) that removes all translations of exception messages.

User interface changes

Not really, exceptions should not be shown to end users

API changes

No.

Original report by @xjm

#1987602-79: Convert ajax_form_callback() to a new style controller β†’

πŸ› Bug report
Status

Fixed

Version

8.9 ⚰️

Component
BaseΒ  β†’

Last updated 1 minute ago

Created by

πŸ‡¬πŸ‡§United Kingdom vijaycs85 London, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024