bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PHP extractor bug


From: Bruno Haible
Subject: Re: PHP extractor bug
Date: Fri, 1 Oct 2004 14:55:59 +0200
User-agent: KMail/1.5

Markus Bertheau wrote:
> I'm using gettext to i18nize PHP software and observed, that gettext is
> wrongfully extracting a string to translate, namely "name", out of the
> following line of code:
>
> $this->selBaseType->lOptions[$lRow["name"]] = _($lRow["name"]);

_() is used to mark string literals to be extracted. There are two ways you
can achieve what you want:

  a) Use "xgettext -k -k_" and then use the 'gettext' instead of '_' when
     you have an expression which contains string literals that should not
     be extracted.

  b) Rewrite the code a bit:

       $foo = $lRow["name"];
       $this->selBaseType->lOptions[$foo] = _($foo);

The fact that xgettext extracts string literals even when surrounded by
other tokens is a feature that is immensely useful in some cases.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]