Line 2990 goes:
watchdog('file system', 'Did not delete temporary file "%path" during garbage collection, because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);

Although in English it sounds ok for either plural or singular, it is not the same in Brazilian Portuguese, for example. I'm unsure about the fix, maybe a format_plural would do?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

franz’s picture

Forgot to say, this is in modules/system/system.module

franz’s picture

Component: language system » user interface text

Better component

Yaron Tal’s picture

FileSize
1.1 KB

You can't use format_plural because that would also translate the string. The best way I can see is to have 2 different strings which are (in english) only slightly different.

I attached a patch which will fix the problem, I'm just not entirely sure it's the best way to do this.

franz’s picture

Status: Active » Needs review

I've just seen that the string is actually in plural... Perhaps this fix is right for this then, let's wait for a review

Status: Needs review » Needs work

The last submitted patch, watchdog_plural.patch, failed testing.

Yaron Tal’s picture

FileSize
1.09 KB

I see other patches don't have the a/filename and b/filename paths, fixed it.

Yaron Tal’s picture

Status: Needs work » Needs review
franz’s picture

Yaron Tal, see the patch documentation, there is a link for git (I assume you're using it), and there are some usefull alias configuration to generate proper patches. I always forget to use it, but it's very handy

franz’s picture

Version: 7.0 » 7.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: +Novice

I guess this is really ok to go

rfay’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs backport to D7

This is a -p0 patch - needs to be rerolled.

franz’s picture

Status: Needs work » Needs review
FileSize
1.1 KB

Re-rolled

franz’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Needs work

Can we add a comment here to explain why we can't use format_plural() here? I can see someone trying to "optimize" this later.

franz’s picture

Status: Needs work » Needs review
FileSize
1.12 KB

Re-rolled, added comment.

I tried to improve legibility as well by separating the 2 messages from the watchdog function call, this way is less confusing, I believe.

Status: Needs review » Needs work

The last submitted patch, 1053690-watchdog-plural.patch, failed testing.

franz’s picture

Status: Needs work » Needs review
FileSize
1.12 KB

Ooops.

Niklas Fiekas’s picture

Status: Needs review » Needs work
Schnitzel’s picture

Status: Needs work » Needs review
FileSize
1.2 KB

reroll and also adapted the text, because it was changed in the meantime by #806974: Punctuation errors in messages

Niklas Fiekas’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

oriol_e9g’s picture

Why don't use format_plural insteaf of if...else structure?

EDIT: Ops, sorry, because watchdog don't need to be translated. RTBC.

jbrown’s picture

Status: Reviewed & tested by the community » Needs work

The bulk of the message is the same whether modules is plural or not. There is no point in repeating the whole thing twice.

Gábor Hojtsy’s picture

1. The message would need to be included verbatim with watchdog() to be extracted for translation. The way it is used in the patch it will not be translatable by the community.

2. count($references) == 1 is a very bad way to decide whether to use plural or non-plural strings. Different languages have different rules, some even have 4 different versions of a string based on the number.

watchdog() unfortunately has no support for plurals yet, this should either be accepted, or watchdog() itself should be improved to take a translation callback like hook_menu() implements so that it can support plurals clearly. Solving that problem would be required to solve this issue cleanly.

sun’s picture

This issue won't fix for me - implementing proper plural grammar/logic for system log messages is totally not worth the effort.

Almost no one reads log messages, and those who do, do not care for grammar.

Gábor Hojtsy’s picture

That is likely why watchdog() did not yet get plural support for quite some time now.

akalata’s picture

So, just set this as a 'won't fix' and call it done?

webchick’s picture

Status: Needs work » Closed (won't fix)

Done.