GNU Info

Info Node: (python2.1-lib.info)Changing languages on the fly

(python2.1-lib.info)Changing languages on the fly


Next: Deferred translations Prev: Localizing your application Up: Internationalizing your programs and modules
Enter node , (file) or (file)node

Changing languages on the fly
.............................

If your program needs to support many languages at the same time, you
may want to create multiple translation instances and then switch
between them explicitly, like so:

     import gettext
     
     lang1 = gettext.translation(languages=['en'])
     lang2 = gettext.translation(languages=['fr'])
     lang3 = gettext.translation(languages=['de'])
     
     # start by using language1
     lang1.install()
     
     # ... time goes by, user selects language 2
     lang2.install()
     
     # ... more time goes by, user selects language 3
     lang3.install()


automatically generated by info2www version 1.2.2.9