Reputation: 2428
In my template file I have something like this:
{% blocktrans %}There are {{news|length}} news{% endblocktrans %}
But translation always misses the {{news|length}}
in it (prints out 'There are news').
My django.po file is auto generated via django-admin.py makemessages --all
msgid "There are %(news|length)s news"
msgstr "%(news|length)s tane haber var"
I know that I can try to pass this string in views.py but is there any way to do it in templates or what am I doing wrong?
Upvotes: 2
Views: 966
Reputation: 599450
You need to use the filter within the blocktrans tag itself.
{% blocktrans with news=news|length %}There are {{ news }} news{% endblocktrans %}
Upvotes: 4