1
You can have variables in blocktrans
blocks, but you can’t access object attributes, as you are attempting with user.username
. You need to bind those to local variables, as per the documentation:
{% blocktrans with amount=article.price %}
That will cost $ {{ amount }}.
{% endblocktrans %}
EDIT: Sorry, I just noticed I misread your question, you do mention local binding. But then that’s your answer. The example you show from django core uses site_name
, not site.name
.
Source:stackexchange.com