在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 bundle 中常见的翻译键 .
这里是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%'
关于symfony - FOSUserBundle 理解 twig 模板变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35830315/