A don't do for internationalizing Django templates
I'm internationalizing a Pinax website and I've encountered this piece of code in a template:
<input type="submit" value="{% trans "invite" %}"/> {% blocktrans %}{{ other_user }} to be a friend.{% endblocktrans %}
The message ids for this code would be two separate blocks: "invite" and " %{other_user}s to be a friend". Both offer very little in terms of context and make the translators job difficult. Correct, in my point of view, would be the more convoluted form of:
{% blocktrans %} <input type="submit" value="invite"/> {{ other_user }} to be a friend. {% endblocktrans %}
This implies that the translators know enough HTML to notice that the value attribute needs to be translated, but the end result is a lot more flexible and provides real context to them.
TL;DR: don't split paragraphs into separate translation units. It's a NO-NO.
UPDATE: I have found what is probably the worst example of how to create a translatable template. Remember, don't assume the English language resembles anything like another language.
{% trans "edited by user" %} {{ obj.editor.username }} {% trans "at"%} {{ obj.modified|date:"H:i" }}
This should be done this way:
{% blocktrans with obj.editor.username as editor_username and obj.modified|date:"H:i" as obj_modified edited by user {{ editor_username }} at {{ obj_modified }} {% endblocktrans %}