I am developing a Vue.js application and want to handle the login via JSON login. This works already but I'd like to translate the error messages, e.g. "Invalid credentials."
My translation.yaml config file.
framework:
default_locale: de
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
The Symfony Security component already has some German (de) translations in its translation directory:
https://github.com/symfony/security-core/blob/master/Resources/translations/security.de.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
...
<trans-unit id="4">
<source>Invalid credentials.</source>
<target>Fehlerhafte Zugangsdaten.</target>
</trans-unit>
...
</body>
</file>
</xliff>
So I copied this file into my translations directory but still the english messages are being displayed. Also I always cleared my cache (thanks to Dylan's answer)