mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Another py3 compat fix
This commit is contained in:
parent
47b3638371
commit
8ce99d51c7
@ -8,6 +8,7 @@ __copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user