My code reviewer correctly rejected this code:
$msg = 'The username %user is not valid.';
$msg = t($msg, array('%user' => $name));

He noted that:
"The first argument of t() must be a literal string; differently, the script that extracts the string to translate to create the translation template will not be able to extract the string, which would not be translatable"

Indeed that's right, but I didn't find it in the documentation of the t() function for either drupal 6 or drupal 7, so I'm requesting that it's added in the function's comment:

http://api.drupal.org/api/function/t/6

Comments

heine’s picture

It's right there in the page. You want to add it to the "Parameters" section?

jhodgdon’s picture

Status: Active » Closed (won't fix)

I think this is a won't fix. It's not as simple as "you can't use a variable", and I think the function doc body adequately explains the reasoning.

alex.a’s picture

Ok. I just wanted the term 'string literal'. I also found out that the translation parsing tools can detect incorrect usage of t().