Customize Authentication - Login Symfony2 Messages

谁说胖子不能爱 提交于 2019-11-27 13:13:15

You can use translation. In parameters.ini set locale to your language and create message file. Then in twig template use:

{% if error %}
    <div class="error">{{ error.message|trans({},'messages') }}</div>
{% endif %}

There is another possibility if you don't want to use translations. You can just replace the message, for example:

{{ error.message | replace({"Bad credentials." : "Invalid username or password."}) }}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!