On Dec 23, 2008, at 10:42 PM, Fernando P. GarcĂa wrote:
I'm sure you have a good reason to pass string $variables to t(), instead of "strings".
What current potx does is to respect(and honor) the Drupal coding starndards. So the "good practice" is to use t("string") for text translation.
Yes, but there are a few cases where it's impossible to do so, and I've hit one of them.
What I suggest is to create a tin 4 lines alias function:
...
But if someone happens to install two modules that define the same tr() function, they get PHP errors on duplicate function definitions. For this to be a viable work-around, it needs to be in your module's namespace, such as mymodule_tr(). I'm not sure that's fundamentally more readable than just doing:
$tr = 't'; $tr($foo);
And, the extra mymodule_tr() function invocation adds even more overhead than the variable...
Anyway, thanks to everyone who participated on this thread, very illuminating.
For anyone interested in the PHPdoc improvements, I posted the issue (with patches) here: http://drupal.org/node/350708
Cheers, -Derek (dww)