Fix UnicodeDecodeError with ngettext and python2
This commit is contained in:
parent
60c52eb13f
commit
6c0acee645
|
@ -27,8 +27,10 @@ import gettext as _gettext
|
|||
try:
|
||||
unicode
|
||||
_ = lambda x: _gettext.gettext(x).decode('UTF-8')
|
||||
ngettext = lambda *x: _gettext.ngettext(*x).decode('UTF-8')
|
||||
except:
|
||||
_ = _gettext.gettext
|
||||
ngettext = _gettext.ngettext
|
||||
|
||||
|
||||
# A few common strings, not always accessible as such in the code.
|
||||
|
|
|
@ -26,8 +26,7 @@ _log = getLogger(__name__)
|
|||
del getLogger
|
||||
|
||||
|
||||
from .i18n import _
|
||||
from gettext import ngettext
|
||||
from .i18n import _, ngettext
|
||||
from .common import NamedInts as _NamedInts, NamedInt as _NamedInt
|
||||
from . import hidpp10 as _hidpp10
|
||||
from . import hidpp20 as _hidpp20
|
||||
|
|
|
@ -60,5 +60,7 @@ _gettext.install(_LOCALE_DOMAIN)
|
|||
try:
|
||||
unicode
|
||||
_ = lambda x: _gettext.gettext(x).decode('UTF-8')
|
||||
ngettext = lambda *x: _gettext.ngettext(*x).decode('UTF-8')
|
||||
except:
|
||||
_ = _gettext.gettext
|
||||
ngettext = _gettext.ngettext
|
||||
|
|
|
@ -26,10 +26,8 @@ del getLogger
|
|||
from gi.repository import Gtk, Gdk, GLib
|
||||
from gi.repository.GObject import TYPE_PYOBJECT
|
||||
|
||||
|
||||
from solaar import NAME
|
||||
from solaar.i18n import _
|
||||
from gettext import ngettext
|
||||
from solaar.i18n import _, ngettext
|
||||
# from solaar import __version__ as VERSION
|
||||
from solaar.ui import ui_async as _ui_async
|
||||
from logitech_receiver import hidpp10 as _hidpp10
|
||||
|
|
Loading…
Reference in New Issue