Some modules have watchdog messages t()-ed, some have not. Since the whole interface of Drupal is translateable, what about leting all watchdog messages to be translated somehow? Watchdog types are already translated (when printed out and not when stored)...

The .pot extactor script should also be extended to recognize watchdog type names (first param to watchdog()), since they are also target for translation.

  • The only problem is what translation to use in these cases on a multilingual site (ie. more then one locale set up in Drupal). The site default language should be used I guess. But then t() should be extended to use the site default langauge if a parameter says so. But then locale() needs that extra parameter, and then for users not having the default language set, two langauge caches would be loaded into memory, so it is not too performant...
  • The second option is to let the watchdog messages be translated later on when displayed. But then dynamic contents would not be allowed, so we would need to have a new db field, containing the serialized dynamic data that should be applied to the t() call when messages are displayed. This brings us to the problem of storing translated data in the dynamic part (eg. "23 bytes" or "2 days before" are targets for translation).
  • Or we could go on with not translating the watchdog() messages, but then this should be set as a rule, and all t()-ed watchdog messages should be "un"t()-ed. Drupal will not be as useable as it could be in this case, but we get rid of some of the ugly problems outlined above...
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stefan Nagtegaal’s picture

Assigned: Unassigned » Stefan Nagtegaal
FileSize
8.26 KB

This patch takes care for the following files:

  • cron.php;
  • common.inc;
  • database.pear.inc;
  • aggregator.module;
  • blogapi.module;
  • node.module;

I will continue sending patches, so we can finally close this task...

Still todo:

  • book.module
  • comment.module
  • drupal.module;
  • ping.module;
  • queue.module;
  • search.module;
  • throttle.module;
  • user.module;
Stefan Nagtegaal’s picture

FileSize
18.29 KB

This patch ovverrides the previous one... This patch fixes all untranslatable watchdog strings...

I would really like to see this hit CVS...

Dries’s picture

I'm OK with the patch. Not sure what others have to say about it.

Gábor Hojtsy’s picture

The only problem with t()-ing all watchdog messages is that the t() will be using the locale selected for the user when the watchdog logged event happens. That means that on multilanguage websites, the watchdog log will be multilingual. I don't see any other problem though.

Anonymous’s picture

The patch doesn't seem to specifically address the first two bullets - the first bullet seems to address Goba's comment. However, from the standpoint of "what is Drupal doing now?", I think this patch is "ok", mainly because Drupal is /already/ t()ing some watchdog messages (just not everywhere), and no one brought these points up before. If anything, now that all watchdog entries have been t()'d, a second patch should be opened to address the locale issue.

Looking at the patch, there does seem to be a slight discrepancy concerning quotes and apostraphes to signify named content. I'm not sure if this is covered in any sort of "message style guide". The original code uses something like:

aggregator: updated URL for feed "[title]" to [url]

but the t()'d code forgoes the quotes around [title]. I personally prefer the double quotes. The same sorta thing shows up a few patch lines later with %site (the second instance of %site, even more lines later, /is/ quoted properly, however). Continuing on, the first change to blogapi.module flips the original single-quoted to double-quoted under watchdog (I prefer the double-quote).

Shall I provide a new patch file with my anal changes, standardizing quotes to double?

Morbus Iff’s picture

Bah, #5 is me.

Dries’s picture

Standardizing the quotes in messages is a good thing. An updated patch is welcomed.

Morbus Iff’s picture

FileSize
17.88 KB

I've taken the drupal_28 patch and tweaked the quotes. Attached.

Dries’s picture

At first glance, that patch does not appear to apply against HEAD.

Morbus Iff’s picture

Dunno about drupal_28, but mine was just an editing of that file - I won't have time to create a proper patch from scratch/HEAD for awhile (still working on converting my existing site over).

Stefan Nagtegaal’s picture

New patch against most recent CVS..

Please apply or comment on this what should be changed...

Dries’s picture

Committed to HEAD.

Anonymous’s picture