我如何翻译父模板中的整个块page.html.twig
:
{# app/Resources/views/page.html.twig #}
{% extends '::bootstrap.html.twig' %}
{% block page %}
<div class="page-header">
<h1>{% block header %}{% endblock %}
<small>{% block small %}{% endblock %}</small></h1>
</div>
<div id="content" class="container-fluid">
{% block content %}{% endblock %}
</div>
{% endblock %}
...而不是调用trans
每个子模板?
{# src/AcmeHelloBundle/Resources/views/User/show.html.twig #}
{% extends '::page.html.twig' %}
{% block header %}{% trans %}Utente{% endtrans %}{% endblock %}
{% block small %}{% trans %}dettaglio{% endtrans %}{% endblock %}
{% block content %}{% endblock %}
我试过环绕{% block header %}
,{% trans %}
但它抱怨trans
应该是一个简单的字符串而不是一个表达式。