localization and gettext in python

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")

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha