title: Django {% blocktrans %}: How to handle pluralization inside a for loop?
body: <p>I have the following loop in my Django template:</p>
  
  <pre><code>{% for item in state.list %}
  
      &lt;div&gt; HTML (CUSTOMERS BY STATE) &lt;/div&gt;
  
      &lt;!-- print sum of customers at bottom of list --&gt;
      {% if forloop.last %}
          &lt;h4&gt;{{ forloop.counter }} Valued Customers&lt;/h4&gt;
      {% endif %}
  
  {% endfor %}
  </code></pre>
  
  <p>Obviously, if I end up with only one customer, I'd like to print singular "Valued Customer"</p>
  
  <p>According to Django's <a href="https://docs.djangoproject.com/en/dev/topics/i18n/translation/#std%3atemplatetag-blocktrans" rel="nofollow">docs</a>, one should use <code>blocktrans</code>. Tried the following, a few flavors of nesting:</p>
  
  <pre><code>    {% blocktrans count %}
          {% if forloop.last %}
              &lt;h4&gt;
                  {{ forloop.counter }}
                  &amp;nbsp;Valued Customer
                  {% plural %}
                  &amp;nbsp;Valued Customers
              &lt;/h4&gt;
          {% endif %}
      {% endblocktrans %} 
  </code></pre>
  
  <p>Keep getting <strong>TemplateSyntaxError: Invalid block tag: 'blocktrans', expected 'empty' or 'endfor'</strong></p>
  
  <p>Is there no way to combine with another loop? Any ideas how to solve? Thanks!</p>