I have to translate a website where the page content can be writen in English or in French.
So I made two files in my translations repository:
- message.en.yml (to translate french to english when the locale is en_us or en_gb)
- message.fr.yml (to translate english to french when the locale is fr)
To explain my issue I will take an exemple, the pair of word Hardware | Matériel
.
When the page is viewed with fr locale Hardware
need to be translated by Matériel
.
So I put : Hardware: Matériel
in my message.fr.yml
.
When the page is viewed with en_us or en_gb locale Matériel
need to be translated by Hardware
.
So I put : Matériel: Hardware
in my message.en.yml
.
At this point the translation behaviour is:
When the page is viewed with the fr locale Hardware
is correctly translated.
When the page is viewed with the en_gb locale Hardware
is correctly not translated.
When the page is viewed with the en_us locale Hardware
is incorrectly translated by Matériel
.
To add to the fun, if I clear the Symfony cache, the behaviour change, sometimes everything get translated by Matériel
, sometimes nothing does...
A week ago I only needed to translate French to English and it worked perfectly by just using the message.en.yml file, maybe there is something to do that I didn't noticed when you use several files.
Can someone explain me how to handle this two way translation?