On Sat, 2009-04-11 at 12:40 -0700, Kless wrote: > I would to pluralize into a translation block [1] but I also want to > apply the 'apnumber' template filter [2] > ----------- > {% load humanize %} > {% load i18n %} > > {% blocktrans count list|apnumber as number %} > There is {{ number }} object. > {% plural %} > There are {{ number }} objects. > {% endblocktrans %} > ----------- > > The problem is that if the filter is used then the 'plural' tag > doesn't works. > > Is there any way to solve it?
Indeed, this is possible. You need to use a number for the counting portion of the blocktrans-plural combination, so that gettext can use the number to determine the plural form. The trick is that you use the same variable again, combined with a filter as another alias inside the translation block to represent the content you want. Like this: {% blocktrans count list as number and list|apnumber as word %} There is {{ word }} object. {% plural %} There are {{ word }} objects. {% endblocktrans %} Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---