mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -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
|
import io
|
||||||
from gettext import GNUTranslations
|
from gettext import GNUTranslations
|
||||||
|
from calibre.constants import ispy3
|
||||||
from calibre.utils.localization import get_lc_messages_path
|
from calibre.utils.localization import get_lc_messages_path
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
@ -34,4 +35,5 @@ def translate(lang, text):
|
|||||||
_CACHE[lang] = trans
|
_CACHE[lang] = trans
|
||||||
if trans is None:
|
if trans is None:
|
||||||
return getattr(__builtins__, '_', lambda x: x)(text)
|
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