Commit cc655348 authored by Andy Holmes's avatar Andy Holmes Committed by Nicolas Fella

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.
parent 9afa6b6d
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment