[translations] Use of variables in t()
Derek Wright
drupal at dwwright.net
Tue Dec 23 10:36:03 UTC 2008
In the D6 API docs for t(), it says:
http://api.drupal.org/api/function/t/6
> The only case in which variables can be passed safely through t() is
> when code-based versions of the same strings will be passed through
> t() (or otherwise extracted) elsewhere.
...
I have a few questions about this:
A) The D5 docs don't say the same thing. However, this seems like the
sort of thing that would be equally true of t() in both branches,
unrelated to all the i18n changes in D6. Can someone confirm that t()
didn't change in D6 to allow for this edge-case, but only that the API
docs improved?
B) I seem to have an example in one of my contribs where this edge
case is being hit. Once I add t($foo) to my code (where all possible
values of $foo are listed via t() around string literals elsewhere in
the code), potx.php starts throwing error messages about "Invalid
marker content ...". Is there anything I can do to tell potx "yes, I
know, but this is that edge case where it's ok, please shut up
again"? ;)
Thanks,
-Derek (dww)
More information about the translations
mailing list