星期二 十二月 09, 2008

import gettext

''' 
gettext module will use the encoding specified in Content-Type header for 
Gnu mo files, and convert the message strings to unicode. Here you could 
sepcify the *output* encoding to others.
'''
gettext.bind_textdomain_codeset('gedit', codeset='UTF-8')

''' 
gettext module will try to retrieve messages from /usr/share/locale by 
default, otherwise you need to explicitly set it. 
'''
gettext.bindtextdomain ('gedit', '/usr/share/locale')

_ = lambda msg: gettext.dgettext ('gedit', msg)
N_ = lambda msg: msg

print _("Save")

This blog copyright 2009 by yongsun