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.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to