On Thu, Feb 5, 2009 at 4:21 PM, Tipan <t...@ortengo.co.uk> wrote: > [...] > > Docs show: > {% blocktrans count list|length as counter %} > There is only one {{ name }} object. > {% plural %} > There are {{ counter }} {{ name }} objects. > {% endblocktrans %} > > My template has: > {% blocktrans with user_points_value as user_points_value_t %}That's > {{ user_points_value_t}} entry.{% plural %}That's > {{ user_points_value_t}} entries.{% endblocktrans %} > > Throws a template syntax error: > 'blocktrans' doesn't allow other block tags (seen u'plural') inside it
You want to use "count" instead of "with" in the blocktrans tag: >>> from django.template import Context, Template >>> t = Template(""" ... {% load i18n %} ... {% blocktrans count user_points_value as user_points_value_t %} ... That's {{ user_points_value_t}} entry. ... {% plural %} ... That's {{ user_points_value_t}} entries. ... {% endblocktrans %} ... """) >>> print t.render(Context({'user_points_value': 1})).strip() That's 1 entry. >>> print t.render(Context({'user_points_value': 2})).strip() That's 2 entries. Cheers, Arien --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---