summaryrefslogtreecommitdiff
path: root/portato/gui/windows/gettext.pyx
blob: c8174e80ff5967399df9102ba60de8d54d52b860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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