Hi,
The extractor.php only allows the extraction of strings contained inside, for example t(). Now, let's suppose we have some data in an array, that will be processed by t() later; but we want to extract that information for translation.
Example:
$data = array('One', 'Two', 'Three');
foreach($data as $key => &$value) {
$value = t($value);
}
How can we extract that data? Could we define a comment, for example
// locale: One, Two, Three
that could allow the extractor.php to work with?
Regards,
Fernando Silva
Comments
Comment #1
cog.rusty commentedThis example could be even worse:
Even if t() could evaluate the variable at run time (which it can't, I think), this is impossible for extractor. Apparently this is bad code. A bug. It should be something like:
Sorry if this is not valid php, I don't know php, but you get the idea.
Comment #2
cog.rusty commentedAll this said, +1 to extractor support for a "// locale: One, Two, Three" kind of thing for cases where it is difficult to put the t() in the code.
Comment #3
cog.rusty commentedUgh... I meant
$data = array(t('One'), t('Two'), t('Three'));Comment #4
gábor hojtsyCogRusty, you have shown how to make this code compatible with t(). These examples are very easy to make t() compatible. Maybe you can show me an example, where it is not possible, and where we would really need some meta stuff?
Comment #5
gábor hojtsyNo example.