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 f01be6d commit 12c463d
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cookbook/template_jinja.md
Expand Up @@ -23,14 +23,14 @@ You need to install both Jinja2 and webpy(0.3) first, and then try out the follo


render = render_jinja( render = render_jinja(
'templates', # Set template directory. 'templates', # Set template directory.
#extensions = ['jinja2.ext.i18n'], # Jinja2 extensions. encoding = 'utf-8', # Encoding.
#encoding = 'utf-8', # Encoding.
#globals = {},
) )


# Used for Jinja2 i18n extension. # Add/override some global functions.
#lang = gettext.translation('domain', 'localedir', languages=['zh_CN']) # render._lookup.globals.update(
#render._lookup.install_gettext_translations(lang) var=newvar,
var2=newvar2,
)


class hello: class hello:
def GET(self, name): def GET(self, name):
Expand All @@ -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 ### Template file: templates/hello.html


Hello, {{ name }}. Hello, {{ name }}.

For i18n string:

{{ _('Hello') }}, {{ name }}.

0 comments on commit 12c463d

Please sign in to comment.