-1

I want my django template variables were possible to translate. I used for this purpose {% blocktrans %}.

Is this code is correct and can be optimized. I mean to write better? The loop or something like that.

{% for obj in objects %}
    {% blocktrans with obj.user as user and obj.country as country and obj.b_day as b_day %}
    <tr>
        <td>{{ user }}</td>
        <td>{{ country }}</td>
        <td>{{ b_day }}</td>
    </tr>
    {% endblocktrans %}
{% endfor %}
catavaran
  • 44,703
  • 8
  • 98
  • 85
mark
  • 653
  • 1
  • 10
  • 23

1 Answers1

0

Hm, I suspect your code don't work properly. Anyway the simple {% trans %} tag looks much better:

{% for obj in objects %}
    <tr>
        <td>{% trans obj.user %}</td>
        <td>{% trans obj.country %}</td>
        <td>{% trans obj.b_day %}</td>
    </tr>
{% endfor %}
catavaran
  • 44,703
  • 8
  • 98
  • 85