Closed (won't fix)
Project:
Drupal core
Version:
6.16
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 May 2010 at 07:09 UTC
Updated:
31 May 2010 at 08:48 UTC
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:
Comments
Comment #1
heine commentedIt's right there in the page. You want to add it to the "Parameters" section?
Comment #2
jhodgdonI 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.
Comment #3
alex.a commentedOk. I just wanted the term 'string literal'. I also found out that the translation parsing tools can detect incorrect usage of t().