[Fixed]-Django template {% trans %} pluralization

19👍

You forgot the count variable as variable_name in the blocktrans tag

The value of that variable will be used to detect if it’s plural or not.

{% blocktrans count variable as variable_name %}
    time
    {% plural %}
    {{ variable_name }} times
{% endblocktrans %}
👤naw

-4👍

You can use:

{% blocktrans with video.views.count|pluralize as foo  and  video.views.count as views %}
The video has been viewed <span>{{ views }}</span> time{{ foo }}
{% endblocktrans %}

Leave a comment