GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 6.23.3.3 Changing languages on the fly

Previous Page Up One Level Next Page Python Library Reference Contents Module Index Index
Previous: 6.23.3.2 Localizing your application Up: 6.23.3 Internationalizing your programs Next: 6.23.3.4 Deferred translations

6.23.3.3 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()


Previous Page Up One Level Next Page Python Library Reference Contents Module Index Index
Previous: 6.23.3.2 Localizing your application Up: 6.23.3 Internationalizing your programs Next: 6.23.3.4 Deferred translations

See About this document... for information on suggesting changes.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.