gettext and "disambiguating comments"

"Martin v. Löwis" martin at v.loewis.de
Mon Jul 11 18:40:19 EDT 2005


Terry Hancock wrote:
> /* Comment right before the gettext call, obviously in C */
> printf(_("Apparently ambiguous string to translate"));
> 
> This will get captured into the .po file, according to the
> gettext manual and appear as a comment right before
> the msgid (i.e. next to the line number reference).

Not automatically. You need to pass the -c option to xgettext
to make that happen, preferably using a tag:

/* TRANSLATORS: Comment right before the gettext call */

> Is there an equivalent Python gettext idiom?  I've tried the
> obvious 
> 
> # Comment right before the gettext call, now in Python
> print _("Apparently ambiguous string to translate")
> 
> But this is ignored by both pygettext and xgettext.

Did you give -c to xgettext? It works for me, for xgettext
0.14.5. -c appears to be unimplemented in pygettext.

Regards,
Martin



More information about the Python-list mailing list