Re: Template variables in translation blocks
On 24/08/13 14:56, Ariel Calzada wrote:
> you have to append strings first
>
> http://stackoverflow.com/questions/4386168/how-to-concatenate-strings-in-django-templates
>
> and then call trans
>
>
>
> 2013/8/24 Some Developer <someukdeveloper@gmail.com
> <mailto:someukdeveloper@gmail.com>>
>
> I have a title and a header block which normally contain static text
> but for some pages I need to display some dynamic information
> contained in a template variable.
>
> So I might have the template variable: {{ app.name <http://app.name> }}
>
> and the block code:
>
> {% block title %}
> {% trans "{{ app.name <http://app.name> }} Information" %}
> {% endblock %}
>
> Obviously this doesn't work. What is the correct way to solve this
> issue? I've done it in the past but I can't for the life of me
> remember how.
This was actually significantly easier than described above. The
following works just fine and is much simpler than having to deal with
string concatenation in templates.
{% blocktrans with app_name=app.name %}
Edit {{ app_name }}
{% endblocktrans %}
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home