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

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

Re: xgettext and HTML


From: Bruno Haible
Subject: Re: xgettext and HTML
Date: Fri, 21 Oct 2005 14:16:58 +0200
User-agent: KMail/1.5

Philipp Thomas wrote:
> as I don't understand the help (and info) text for --add-comments either,
> can you help us here?
>
> * Jiří Suchomel (address@hidden) [20051021 11:55]:
> > we would like to use gettext to translate the web application. I was able
> > to extract the strings from HTML file with "xgettext --language=PHP", but
> > this is not able to fetch also the comments. How can I say xgettext about
> > the comment format?
> > I don't understand if and how can I use the TAG of "--add-comments[=TAG]
> > option for this.
>
> Example
> ----------------------------
> <%= _("My systems") %>
>
> <%=_("Lastest Updates")%>
> ----------------------------

First of all, xgettext does not support extracting strings from HTML
documents, because when you do that, you also need to put back the translated
strings into HTML. xgettext does not support this so far. But the KDE
(and IIRC also the GNOME project) have tools for this.

But PHP is supported by xgettext. For example:

===================================================
<?
// This comment will not be extracted.
echo _("help");
//  TRANSLATORS: This is an extracted comment.
echo _("me");
# TRANSLATORS: This is extracted too.
echo _("and you");
/* Not extracted either. */
echo _("Hey Jude");
/*  TRANSLATORS:
     Nickname of the Beatles
*/
echo _("The Fabulous Four");
?>
====================================================

"xgettext --add-comments=TRANSLATORS:" will extract strings and comments
meant for the translator.

Bruno






reply via email to

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