summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-09-03 18:42:52 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-09-03 18:42:52 +0200
commit36752ebb554be1b395ba0dfa8605fb575d70f4a5 (patch)
tree3bc8b8904364460aa5eb419b59e1c2dac6177dee
parentf4306735d5282275e0e646f4f86a236564714e05 (diff)
downloadportato-36752ebb554be1b395ba0dfa8605fb575d70f4a5.tar.gz
portato-36752ebb554be1b395ba0dfa8605fb575d70f4a5.tar.bz2
portato-36752ebb554be1b395ba0dfa8605fb575d70f4a5.zip
Add small wrapper to C-gettext
-rw-r--r--portato/gui/windows/gettext.pyx18
-rw-r--r--setup.py5
2 files changed, 22 insertions, 1 deletions
diff --git a/portato/gui/windows/gettext.pyx b/portato/gui/windows/gettext.pyx
new file mode 100644
index 0000000..c8174e8
--- /dev/null
+++ b/portato/gui/windows/gettext.pyx
@@ -0,0 +1,18 @@
+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
diff --git a/setup.py b/setup.py
index 700ab4b..e8dc2cb 100644
--- a/setup.py
+++ b/setup.py
@@ -40,7 +40,10 @@ data_files = [
(PLUGIN_DIR, plugin_list("gpytage", "notify", "etc_proposals", "reload_portage", "package_details"))]
# extension stuff
-ext_modules = [Extension("portato.ipc", ["portato/ipc.pyx"])]
+ext_modules = [
+ Extension("portato.ipc", ["portato/ipc.pyx"]),
+ Extension("portato.gui.windows.gettext", ["portato/gui/windows/gettext.pyx"])
+ ]
if "--disable-eix" in sys.argv:
sys.argv.remove("--disable-eix")