I'm new in Symfony 3 and I hope you can help me.
I want to use the translation component in my project, I followed this steps " https://symfony.com/doc/3.4/translation.html#configuration " but when I clear the cache with the CLI, I have this error and the translations don't work:
>php bin/console cache:clear
// Clearing the cache for the dev environment with debug true
In XliffFileLoader.php line 56:
Unable to load "C:\wamp64\www\MyWebSite/translations\messages.en_US.xlf": [ERROR 64] XML declaration allowed only at the start of the document (in n/a - line 2, column 6)
In XmlUtils.php line 62:
[ERROR 64] XML declaration allowed only at the start of the document (in n/a - line 2, column 6)
These are my files:
app/config/config.yml
parameters: locale: en framework: #esi: ~ translator: { fallbacks: ['%locale%'] }
translations\messages.fr_FR.xlf
<!-- messages.fr.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="symfony_is_great"> <source>Symfony is great</source> <target>J'aime Symfony</target> </trans-unit> </body> </file> </xliff>
I use the tanslation in Twig file
{% trans %} Symfony is great { endtrans %}
I hope you can help me !!