diff options
Diffstat (limited to 'deluge/i18n/util.py')
-rw-r--r-- | deluge/i18n/util.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/deluge/i18n/util.py b/deluge/i18n/util.py index 6ed4b97da..df2e3ab8a 100644 --- a/deluge/i18n/util.py +++ b/deluge/i18n/util.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2007,2008 Andrew Resch <andrewresch@gmail.com> # @@ -7,8 +6,7 @@ # See LICENSE for more details. # -from __future__ import unicode_literals - +import builtins import ctypes import gettext import locale @@ -17,8 +15,6 @@ import os import sys from glob import glob -from six.moves import builtins - import deluge.common from .languages import LANGUAGES @@ -80,7 +76,7 @@ def set_language(lang): translation = gettext.translation( 'deluge', localedir=get_translations_path(), languages=[lang] ) - except IOError: + except OSError: log.warning('Unable to find translation (.mo) to set language: %s', lang) else: translation.install() @@ -113,19 +109,17 @@ def setup_translation(): gettext.bindtextdomain(I18N_DOMAIN, translations_path) gettext.textdomain(I18N_DOMAIN) - # Workaround for Python 2 unicode gettext (keyword removed in Py3). - kwargs = {} if not deluge.common.PY2 else {'unicode': True} - - gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'], **kwargs) + gettext.install(I18N_DOMAIN, translations_path, names=['ngettext']) builtins.__dict__['_n'] = builtins.__dict__['ngettext'] def load_libintl(libintls): errors = [] + libintl = None for library in libintls: try: libintl = ctypes.cdll.LoadLibrary(library) except OSError as ex: - errors.append(ex) + errors.append(str(ex)) else: break |