Another py3 compat fix

This commit is contained in:
Kovid Goyal 2019-12-19 15:14:31 +05:30
parent 47b3638371
commit 8ce99d51c7
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -8,6 +8,7 @@
import io
from gettext import GNUTranslations
from calibre.constants import ispy3
from calibre.utils.localization import get_lc_messages_path
from zipfile import ZipFile
@ -34,4 +35,5 @@ def translate(lang, text):
_CACHE[lang] = trans
if trans is None:
return getattr(__builtins__, '_', lambda x: x)(text)
return trans.ugettext(text)
f = getattr(trans, 'gettext' if ispy3 else 'ugettext')
return f(text)