I have this part of code in login.html.twig page
I want to translate error message "Invalid credentials."
{% if error %}
<div style="color:red">
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}
now, i'm trying to translat in messages.en.yml or in FOSUserBundle.en.yml and nothing happen. (using symfony3)
After looking for a while, I found it can help
I looked for where the message came fromץץ and i found that this message "Invalid credentials." coming from this path.
vendor\symfony\symfony\src\Symfony\Component\Security\Core\Resources\translations\security.en.xlf
so i copeid the file security.en.xlf into app\Resources\translations and made some change to the part i wanted to translate
<trans-unit id="4">
<source>Invalid credentials.</source>
<target>Username/password doesn't match</target>
</trans-unit>
Btw, in my case, I just uncomment the following line in config.yml :
framework:
translator: { fallbacks: ['%locale%'] }
And my locale was set to "fr"
parameters:
locale: fr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With