Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

edit

  • Loading branch information...
commit 12c463da98a0d20d0f6e8a625ef97a2e02127612 1 parent f01be6d
Bibby authored anandology committed
Showing with 7 additions and 11 deletions.
  1. +7 −11 cookbook/template_jinja.md
View
18 cookbook/template_jinja.md
@@ -23,14 +23,14 @@ You need to install both Jinja2 and webpy(0.3) first, and then try out the follo
render = render_jinja(
'templates', # Set template directory.
- #extensions = ['jinja2.ext.i18n'], # Jinja2 extensions.
- #encoding = 'utf-8', # Encoding.
- #globals = {},
+ encoding = 'utf-8', # Encoding.
)
- # Used for Jinja2 i18n extension.
- #lang = gettext.translation('domain', 'localedir', languages=['zh_CN'])
- #render._lookup.install_gettext_translations(lang)
+ # Add/override some global functions.
+ # render._lookup.globals.update(
+ var=newvar,
+ var2=newvar2,
+ )
class hello:
def GET(self, name):
@@ -41,8 +41,4 @@ You need to install both Jinja2 and webpy(0.3) first, and then try out the follo
### Template file: templates/hello.html
- Hello, {{ name }}.
-
-For i18n string:
-
- {{ _('Hello') }}, {{ name }}.
+ Hello, {{ name }}.
Please sign in to comment.
Something went wrong with that request. Please try again.