1

I am nearing the final stages of a project and have run into a bit of a hiccup with Django.

It relates to the {% blocktrans %} tag.

How do I enable it to be fully functional in my app, currently if I wrap a piece of text in {% blocktrans %} I get a TemplateSyntaxError message

I have the following in my

TEMPLATE_CONTEXT_PROCESSORS = (
...
"django.core.context_processors.i18n",
...
)

Any help would be appreciated.

4

1 回答 1

3

对我来说是这样的(windows + python 2.6 + django 1.2.1)

  1. 将导致错误(TemplateSyntaxError):

    {% 加载 i18n %}

    {% blocktrans %} 我的名字是 {{ user.firstname }} {% endblocktrans %}

  2. 将工作:

    {% 加载 i18n %}

    {% blocktrans with user.firstname as hmpf %} 我的名字是 {{ hmpf }} {% endblocktrans %}

于 2011-01-26T15:48:21.827 回答