FOSUserBundle 理解 twig 模板变量

FOSUserBundle understanding twig template variables

在layout.html.twig文件中;

{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
        {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} |
        <a href="{{ path('fos_user_security_logout') }}">
            {{ 'layout.logout'|trans({}, 'FOSUserBundle') }}
        </a>
    {% else %}
        <a href="{{ path('fos_user_security_login') }}">{{ 'layout.login'|trans({}, 'FOSUserBundle') }}</a>
    {% endif %}

布局属性指的是什么?它似乎只是在我的 html 页面中输出字符串,即 'layout.logged_in_as' 和 'layout.logout'

这些是 Symfony 包中常见的翻译键 .

这里是the layout translation definitions that would be translated to English:

layout:
  logout: 'Log out'
  login: 'Log in'
  register: Register
  logged_in_as: 'Logged in as %username%'