The {% trans %} template tag allows you to mark a string, a constant, or variable content for translation. Internally, Django executes gettext() on the given text. This is how to mark a string for translation in a template:
{% trans "Text to be translated" %}
You can use as to store the translated content in a variable that you can use throughout your template. The following example stores the translated text in a variable called greeting:
{% trans "Hello!" as greeting %}
<h1>{{ greeting }}</h1>
The {% trans %} tag is useful for simple translation strings, but it cannot handle content for translation that includes variables.