Closed (works as designed)
Project:
Translation template extractor
Version:
5.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2008 at 21:27 UTC
Updated:
11 Feb 2008 at 10:50 UTC
When using class constants, like:
class Foo {
const X = 'bar';
}
$baz = t(Foo::X);
potx chokes on 'Foo::X', not understanding it as a string. With PHP5 becoming mandatory for newer Drupal versions, this seems poised to happen more and more often.
t() itself, obviously, has no problem with the strings, so a temporary workaround is to add the strings to the .po file by hand.
Comments
Comment #1
gábor hojtsypotx only supports static text by design. It does not support regular constants either.
Comment #2
fgmSo what is the recommended way to localize code using constants ?
Do you think one can really advocate the use of in-code hardcoded text as a recommended practice against defined constants ?
Comment #3
gábor hojtsyfgm: Well, our current practice is text inlining. Feel free to come up with a patch against potx which recognizes the strings in t(), st(), $t(), format_plural() and so on in the form of constants as well, and then discuss.
Ps. note that I am not against the use of named constants, but I am not into implementing it myself.