[translations] Use of variables in t()

Derek Wright drupal at dwwright.net
Tue Dec 23 20:31:20 UTC 2008


On Dec 23, 2008, at 6:53 PM, Hans Salvisberg wrote:

> Here's what I do to get potx to shut up:
>
> $tr = 't';
> $tr($foo)

Slick! ;)  Very clever, thanks!

> I forgot why I'm not using $t, but I think there was a reason...

Because potx still sees "$t($foo)" as if it's "t($foo)" and it gives  
the warning, anyway.  By using $tr($foo) it all works.

I guess it's a minor performance hit to do this, and it slightly  
obfuscates the code, so I doubt we can convince core to either  
implement or document this practice...

@Gabor: thoughts? ;)

Thanks,
-Derek (dww)





More information about the translations mailing list