php-i18n Digest 3 Aug 2002 00:47:02 -0000 Issue 117
Topics (messages 307 through 307):
xgettext and quotes
307 by: a.h.s. boy
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
As many of you may have realized, the xgettext utility, used to
conveniently extract marked text entries from files prepared for gettext
internationization, only works when the text is enclosed in
double-quotes.
Hence,
print _("This is a string");
is recognized as a string for the PO file by xgettext, but
print _('This is a string');
isn't.
A long while ago, I got into the habit of using single-quoted strings
whenever possible, to take advantage of the fact that PHP would not
attempt (needlessly) to interpret variables in the text. Seemed like a
good habit at the time, but the disadvantage of this approach when it
comes to using xgettext is giving me second thoughts about that earlier
decision.
I've noticed that many projects (Squirrelmail, for example) offer i18n
instructions for translators and plug-in authors, including information
on running xgettext to extract the strings, but they never mention that
you MUST enclosed strings in double-quotes.
How has anyone else approached this subject? Are you all in the habit of
using double-quotes, even when there's no variable substitution in the
text, or have you worked out a way to extract strings no matter what
quote style is used?
Personally, I wrote a quick AppleScript that extracts the strings, and
does a pretty good job of it, but it doesn't take note of the file/line
number that the string appears in. It's certainly better than locating
them manually, but it does make commenting the PO file more difficult,
as that still needs to be filled in somewhat to offer translators some
context for the strings.
Just wondering how others are dealing with this...
Cheers,
spud.
--- End Message ---