Derek,
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.
What I suggest is to create a tin 4 lines alias function:
/**
* Alias function of t(), use only with variables and constants.
* For "strings" please use t() instead.
*/
function tr() {
$args = func_get_args();
call_user_func_array('t', $args);
}
I enjoy the $tr = t way, but perhaps core might realize about "what if..." ...somebody needs to silently(abot poedit) translate $variables and CONSTANTS.
Merry Christmas! Feliz Navidad!
Slick! ;) Very clever, thanks!
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)
Because potx still sees "$t($foo)" as if it's "t($foo)" and it gives
> I forgot why I'm not using $t, but I think there was a reason...
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)
_______________________________________________
translations mailing list
translations@drupal.org
http://lists.drupal.org/mailman/listinfo/translations