I get a warning every time I create a translation template for my module:

"The first two watchdog() parameters should be literal strings. There should be no variables, concatenation, constants or even a t() call there. At watchdog('path_redirect',format_plural($count,'Removed 1 inactive redirect from the database.','Removed @count inactive redirects from the database.')) in path_redirect.module on line 142. Read more at http://drupal.org/node/323101"

Core uses this with actions_synchronize(). How should I be using format_plural with watchdog? Or should we fix this warning in potx?

Comments

gábor hojtsy’s picture

Unfortunately watchdog() does not allow for any callback to use but t(). The warning can say that you should try to rework your text to work with t() without requiring any other heavy lifting. Core abuses the API just as it does at some other places with calling t() on dynamic data (where it could not tell whether it comes from code or users). Drupal 7 could fix this by implementing a callback specification mechanism similar to menu title callbacks and arguments.

gábor hojtsy’s picture

Status: Active » Fixed

No feedback, so closing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.