Question

I need to render a translated testimonial and I use an include block for the testimonial code like so:

{% include "includes/blog/testimonial.html" with text="This is the best product I've ever used!" name="Tim Z" description="Store Manager" %}

How would I use blocktrans together with the include tag to render the translated include tag?

Thanks!!

Was it helpful?

Solution

If I understand correctly you want to translate the text you provide to an "include" tag. If this is correct just translate it beforehand and save the result to a variable:

{% trans "This is the best product I've ever used!" as text %}
{% trans "Store Manager" as description %}
{% include "includes/blog/testimonial.html" with text=text name="Tim Z" description=description %}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top