2016-03-26 63 views
4

我在login.html.twig頁面有這部分代碼如何翻譯「憑證無效」。錯誤在FOSUserBundle symfony

我想翻譯錯誤消息「無效的憑據。」

{% if error %} 
    <div style="color:red"> 
     {{ error.messageKey|trans(error.messageData, 'security') }} 
    </div> 
{% endif %} 

現在,我想在messages.en.yml或FOSUserBundle.en.yml並沒有發生translat。 (使用symfony3)

回答

8

找了一段時間之後,我發現它可以幫助

我看着從ץץ 消息哪兒來,我發現,這個消息「無效的憑證。」來自這條路。

vendor\symfony\symfony\src\Symfony\Component\Security\Core\Resources\translations\security.en.xlf 

,所以我copeid文件security.en.xlf應用程序\資源\翻譯 ,取得了一些變化的部分我想翻譯

<trans-unit id="4"> 
    <source>Invalid credentials.</source> 
    <target>Username/password doesn't match</target> 
</trans-unit>