On 17/08/23 7:10 pm, c.bu...@posteo.jp wrote:
def foobar(translate):
if not translate:
# I try to mask the global _() builtins-function
def _(txt):
return txt
return _('Hello')
This causes _ to become a local that is left undefined on one
branch of the if. You need to ensure it's always defined. Here's
one way that should work:
gttran = _
def foobar(translate):
def _(txt):
if translate:
return gttran(txt)
else:
return txt
return _('Hello')
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list