GNU gettext: Print string translated and untranslated at the same time

c.buhtz at posteo.jp c.buhtz at posteo.jp
Thu Aug 17 15:17:49 EDT 2023


Hello Mirko,

thanks for reply.

Am 17.08.2023 18:19 schrieb Mirko via Python-list:
> You could solve it by defining _() locally like so:
> 
> def foobar(translate):
>     _ = gettext.gettext

I see no way to do that. It is not the "class based API" of gettext 
installing _() into the builtins namespace.
My users are able to configure the language of their UI explicit. It is 
a full application.

> def orig_and_trans(msg):
>     return (_(msg), msg)

This will be ignored by GNU gettext utils (xgettext in my case) will 
ignore this line because they do not know what "msg" is. The string 
"hello" won't appear in the pot-file.


More information about the Python-list mailing list