我在login.html.twig页面中有这部分代码
我要翻译错误消息“无效的凭据”。
{% if error %}
<div style="color:red">
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}
现在,我正在尝试在messages.en.yml或FOSUserBundle.en.yml中进行翻译,但没有任何反应。(使用symfony3)
找了一段时间后,我发现它可以帮助您
我查找了消息的来源ץץ,发现此消息为“无效的凭据”。来自这条路。
vendor\symfony\symfony\src\Symfony\Component\Security\Core\Resources\translations\security.en.xlf
所以我将文件security.en.xlf压缩到app \ Resources \ translations中,并对我要翻译的部分进行了一些更改
<trans-unit id="4">
<source>Invalid credentials.</source>
<target>Username/password doesn't match</target>
</trans-unit>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句