T
Terry Hancock
I'm looking at the gettext module for the first time and
learning how to write internationalized code in Python.
Naturally, I also looked at the original Gnu gettext
manual, which mentions that comments can be captured
into the .po (.pot?) file for translators' benefit:
/* 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).
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.
I also saw some discussion (from the Gnome project)
about gettext variations which capture comments from
within the text:
_("comment for translators| Spam")
But, Python's gettext happily renders the entire comment
into the program, so this isn't doing anything either.
Clearly, I could edit the .pot file after creation to
include comments, but that's probably undesireable
since the file is meant to be machine-generated.
I have no pressing immediate need for this functionality
(that I know of), but I'd like to understand how to access
this capability if it exists.
learning how to write internationalized code in Python.
Naturally, I also looked at the original Gnu gettext
manual, which mentions that comments can be captured
into the .po (.pot?) file for translators' benefit:
/* 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).
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.
I also saw some discussion (from the Gnome project)
about gettext variations which capture comments from
within the text:
_("comment for translators| Spam")
But, Python's gettext happily renders the entire comment
into the program, so this isn't doing anything either.
Clearly, I could edit the .pot file after creation to
include comments, but that's probably undesireable
since the file is meant to be machine-generated.
I have no pressing immediate need for this functionality
(that I know of), but I'd like to understand how to access
this capability if it exists.