Default dblog setup breaks translations

Created on 7 June 2023, over 1 year ago
Updated 9 June 2023, over 1 year ago

Translations are broken in the default installation of dblog.

From the internet "The messages are going to be translated already and you don't want to translate twice." until they're not.

So when using e.g.

\Drupal::logger('my_module')->notice('English test message');

With an english-dutch (nl) translation available. I see 'English test message' as text in the dblog overview when my "user language detection" resorts to Dutch, so the messages in the overview are not being translated. However when I go into the detail of the log message I get the dutch translation.

It took a while and a colleague to find out what's going on:
- The DblogController that is used for the Dblog overview does translate messages.
- HOWEVER, there's also a default view "views.view.watchdog.yml" that overrides the latter controller and which does not translate the messages.

Request: Have the watchdog view also translate messages. When you disable the views.view.watchdog you will see that translations work as intended (but the output of the controller looks less nice than the view).

I tried locally modifying the message field in views.view.watchdog to "{{ message | t }}" but that doesn't seem to work to translate the messages in the overview.

🐛 Bug report
Status

Closed: duplicate

Version

9.5

Component
Database Logging 

Last updated 3 months ago

Created by

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

Comments & Activities

Production build 0.71.5 2024