Django templates: enable template movement

I need to pass the following to the included template via the Django include tag:

{% include 'btn.html' with btn_text='Hi '|add:first_name|add:' - Verify Email Now' btn_url=verify_url %} 

Therefore, I can parse the whole question in two parts:

a. Is it possible to add first_name to a string in a different, more elegant style at the template level?

Q. I need the string to be translated at the template level - is this possible?

those. what I intend to do (but not syntactically correctly) is given below:

 {% include 'btn.html' with btn_text= {% blocktrans first_name as first_name %} Hi {{first_name}} - Verify Email Now {% endblocktrans %} btn_url=verify_url %} 
+6
source share
2 answers

I found a solution in this post :

Here is an example:

 {% trans "Load more promotions" as promotions %} {% include "a_dir/stuff.html" with text=promotions %} 
+5
source

To format a string, you can do this in a view and pass it in context:

 context = {'btn_text': 'Hi {0} - Verify Email Now'.format(first_name)} return HttpResponse(context=context) 

To translate the text, read the following link:
https://docs.djangoproject.com/en/1.2/topics/i18n/internationalization/#trans-template-tag

-1
source

Source: https://habr.com/ru/post/959051/