Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibby authored and anandology committed Jan 5, 2011
1 parent 212a9d7 commit 9995565
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cookbook/runtime-language-switch.md
Expand Up @@ -100,6 +100,24 @@ File: code.py
if __name__ == "__main__": app.run()


Template file: templates/index.html.

$_('Hello')

Don't forget to generate necessary po & mo files which used for translations. Reference: [i18n support in template file](/i18n_support_in_template_file)

Now run code.py in terminal:

$ python code.py
http://0.0.0.0:8080/

Now visit below addresses with your favourite web browser, check whether language changed:

http://your_server:8080/
http://your_server:8080/?lang=en_US
http://your_server:8080/?lang=zh_CN

You should:

* Make sure language code (en_US, zh_CN, etc) will be dynamic changed.
* Make sure custom_gettext() calling is as cheap as possible.

0 comments on commit 9995565

Please sign in to comment.