Nautilus Extension: fix gettext usage
Apparently the way we did this in GSConnect never actually worked, it just took years for someone to report it. Since this extension is derived from GSConnect's it's likely that's the case here, too. This is the appropriate way to use gettext according to the Python3 documentation.
This commit is contained in:
parent
9afa6b6d91
commit
cc655348eb
1 changed files with 7 additions and 8 deletions
|
@ -29,12 +29,17 @@ __app_disp_name__ = "Share files to your phone via KDE Connect"
|
|||
__website__ = "https://community.kde.org/KDEConnect"
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
from functools import partial
|
||||
|
||||
from gi.repository import Nautilus, Gio, GLib, GObject
|
||||
|
||||
_ = gettext.gettext
|
||||
try:
|
||||
i18n = gettext.translation('kdeconnect-nautilus-extension')
|
||||
_ = i18n.gettext
|
||||
except (IOError, OSError) as e:
|
||||
print('kdeconnect-nautilus: {0}'.format(e.strerr))
|
||||
i18n = gettext.translation('kdeconnect-nautilus-extension', fallback=True)
|
||||
_ = i18n.gettext
|
||||
|
||||
class KdeConnectShareExtension(GObject.GObject, Nautilus.MenuProvider):
|
||||
"""A context menu for sending files via KDE Connect."""
|
||||
|
@ -55,12 +60,6 @@ class KdeConnectShareExtension(GObject.GObject, Nautilus.MenuProvider):
|
|||
|
||||
self.devices = {}
|
||||
|
||||
try:
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
gettext.bindtextdomain('kdeconnect-nautilus-extension')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
self.dbus = Gio.DBusProxy.new_for_bus_sync(
|
||||
Gio.BusType.SESSION,
|
||||
Gio.DBusProxyFlags.NONE,
|
||||
|
|
Loading…
Reference in a new issue