diff options
-rw-r--r-- | portato/gui/windows/basic.py | 15 | ||||
-rw-r--r-- | portato/gui/windows/gettext.pyx | 18 | ||||
-rw-r--r-- | setup.py | 5 |
3 files changed, 11 insertions, 27 deletions
diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py index 46e345e..3cedd69 100644 --- a/portato/gui/windows/basic.py +++ b/portato/gui/windows/basic.py @@ -20,13 +20,18 @@ from functools import wraps import os.path from ...constants import TEMPLATE_DIR, APP, LOCALE_DIR -from ...helper import error, debug +from ...helper import error # for the GtkBuilder to translate correctly :) -from . import gettext -old_charset = gettext.set_gtk_gettext(APP, LOCALE_DIR) -debug("Changed from old charset '%s' to UTF-8.", old_charset) -del old_charset +import ctypes +try: + getlib = ctypes.cdll.LoadLibrary("libgettextlib.so") +except OSError: + error("'libgettextlib.so' cannot be loaded. Might be, that there are no translations available in the GUI.") +else: + getlib.textdomain(APP) + getlib.bindtextdomain(APP, LOCALE_DIR) + getlib.bind_textdomain_codeset(APP, "UTF-8") class WrappedTree (object): __slots__ = ("klass", "tree", "get_widget", "get_ui") diff --git a/portato/gui/windows/gettext.pyx b/portato/gui/windows/gettext.pyx deleted file mode 100644 index c8174e8..0000000 --- a/portato/gui/windows/gettext.pyx +++ /dev/null @@ -1,18 +0,0 @@ -cdef extern from "langinfo.h": - char* nl_langinfo (int item) - cdef enum: - CODESET - -cdef extern from "libintl.h": - char * textdomain (char* domain) - char * bindtextdomain (char* domain, char* dir) - char * bind_textdomain_codeset (char* domain, char* codeset) - -def set_gtk_gettext (char* domain, char* dir): - textdomain(domain) - bindtextdomain(domain, dir) - - old_charset = nl_langinfo(CODESET) - bind_textdomain_codeset(domain, "UTF-8") - - return old_charset @@ -40,10 +40,7 @@ data_files = [ (PLUGIN_DIR, plugin_list("gpytage", "notify", "etc_proposals", "reload_portage", "package_details"))] # extension stuff -ext_modules = [ - Extension("portato.ipc", ["portato/ipc.pyx"]), - Extension("portato.gui.windows.gettext", ["portato/gui/windows/gettext.pyx"]) - ] +ext_modules = [Extension("portato.ipc", ["portato/ipc.pyx"])] if "--disable-eix" in sys.argv: sys.argv.remove("--disable-eix") |