PyGTK localisation on Win32

Dieter Verfaillie dieterv at optionexplicit.be
Sun Mar 30 06:49:42 EDT 2008


On Thu, 2008-03-27 at 05:21 -0700, Sukhov Dmitry wrote:
> I have the same problem. I did all as you wrote. gettext translations
> do work fine. But translations in glade does not work.
> 
> The only way to turn it on is to set environment variable LANG
> explicitly before program run:
> set LANG=ru_RU
> python test.py

Yep, from python 2.4 on, os.environ changes only work within python and
no longer apply to low level c stuff on win32. Luckily, it's still
possible to force environment variables through the
kernel32.SetEnvironmentVariableW and msvcrt._putenv functions.

Put the attached locale module in a libi18n package and use like this:
#!/usr/bin/env python
from libi18n import locale
locale.fix_locale()
del locale

hth,
Dieter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale.py
Type: text/x-python
Size: 13405 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20080330/3d31d1e1/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20080330/3d31d1e1/attachment-0001.sig>


More information about the Python-list mailing list