wxPython i18n, help wanted

Martin v. Loewis martin at v.loewis.de
Fri Sep 20 03:33:16 EDT 2002

Cedric Dutoit <dutoitc at hotmail.com> writes:

> I'm trying to translate an application in Chinese with i18n, but
> I don't know how to display Chinese characters in wxPython.
> Can anybody help me ?

There are two aspects in your question: How do I translate
applications, and How do I display Chinese characters in wxPython.

For the first question, I recommend to use the Python gettext
module. If you are unfamiliar with gettext, I recommend that you read
the GNU gettext manual; Python gettext follows this model very

For the second question, in most wxPython installations, you can only
display characters supported in the current locale. E.g. if you are in
de_CH.ISO-8859-1 environment, you can only display German characters,
but not Chinese ones. You need to change your system to a zh_CN.gb2312
environment; then you can display chinese characters - you need to
encode the strings in gb2312 (these are Unix examples; on Windows, you
need to change the locale likewise - on W9x, you need a Chinese
edition of Windows).

Starting with wxPython, it supports, on Win32, a "Unicode
build". In that build, wxPython can display arbitrary Unicode strings;
the distribution contains an example that displays Korean among other
languages - it is not hard to deduce display of Chinese from that.  If
you are combining this with gettext, I recommend that you use the
ugettext function, which means that you need to have the proper codecs


More information about the Python-list mailing list