Saturday, November 10, 2012

Is this a bug or am I doing it wrong? (trans tag)

In the documentation it is quite clear that the following syntax is
correct in templates:

{% load i18n %}

{% trans "my_string" as blah_string %}

{{ blah_string }}

etc etc.

This works fine if the original trans tag is inside a block but then the
blah_string variable is only valid within that block. If you place the
trans tag in a global position (outside of any blocks) the blah_string
variable does not work when you try and use it in a block (that is any
block). I am using Django 1.4.2 and think this behaviour is somewhat
strange given the documentation for this particular feature. Surely you
should be able to declare the trans tag outside of any block as the
chances are that you will want to use the blah_string variable in more
than one block (I often have three or four blocks per page for various
things).

So is this a bug or am I doing something wrong?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate