pygettext examples?

Trond Eivind Glomsrød teg at redhat.com
Fri Nov 30 18:32:53 CET 2001


Joseph Santaniello <joseph at arbitrary.org> writes:

> Hi Martin,
> 
> I've gotten my code marked up: (test.py)
> 
> #!/usr/bin/python2 
> import gettext
> 
> def _(msg):
>         return gettext.dgettext("test", msg)
> 
> def do_stuff()
>         print _("I don't know.")
> 
> if __name__ == '__main__':
>         do_stuff()


import gettext
##
## I18N
##
gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
gettext.textdomain(PROGNAME)
_=gettext.gettext

print _("Hello, world!")

-- 
Trond Eivind Glomsrød
Red Hat, Inc.



More information about the Python-list mailing list