Hi, all.
How can i make Jinja2 i18n work in webpy (lastest git version)? the
error log msg is:
----
[Mon Mar 09 23:01:04 2009] [error] [client 127.0.0.1] UndefinedError:
'_' is undefined
----
my code:
----
import gettext
import web
from web.contrib.template import render_jinja
# Use JinJa2 template.
render = render_jinja('templates')
# i18n support in Python script and webpy template file.
# TODO: per-user language setting.
gettext.install('app', localedir, unicode=True)
gettext.translation('app', localedir, languages=['en_US']).install
(True)
----
template file: login.html
----
<h3>{{ _('Login') }}</h3>
<form method="POST">
{% if msg is not none %}
<strong>{{ _('System message:') }} <font color="red">{{ msg }}
</font></strong>
{% endif %}
{# $:form.render() #}
</form>
----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---