[pygtk] gtk.Builder and translation encoding

Andrey Rahmatullin wrar at altlinux.org
Sat Jul 11 21:20:17 WST 2009


Hello.

When gtk.Builder gets a translation for <property translatable="yes"> it
displays it correctly only in UTF-8 locale. C gtk programs are fixed by
adding bind_textdomain_codeset(domain, "utf-8"); I tried to call python
bind_textdomain_codeset, but it didn't help. Here is complete testcase:

#!/usr/bin/python
import gtk
from locale import *
from gettext import bind_textdomain_codeset

setlocale(LC_ALL, '')
bind_textdomain_codeset("libc", "UTF-8")
Builder = gtk.Builder()
Builder.set_translation_domain("libc")
Builder.add_from_string(
"""<?xml version="1.0"?>
<interface><object class="GtkDialog" id="dialog">
<property name="title" translatable="yes">Success</property>
</object></interface>""")
Dialog = Builder.get_object("dialog")
Dialog.resize(300, 100)
Dialog.show()
gtk.main()


-- 
WBR, wRAR (ALT Linux Team)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090711/a3dfd91e/attachment.pgp 


More information about the pygtk mailing list