pygettext examples?

Joseph Santaniello joseph at arbitrary.org
Fri Nov 30 16:52:33 EST 2001


OK, so it works now (I had my directory structure incorrect) but the only 
way I have successfully changed languages on the fly is by using 
os.environ['LANG'] = 'no'. I haven't been able to figure out how to use 
gettext.translation() and install() to change the language. Is there any 
reason why I shouldn't just continue to use the os.environ method?

Thanks everyone for the help.

Joseph

On 30 Nov 2001 at 12:32, Trond Eivind Glomsrød wrote:

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







More information about the Python-list mailing list