cyber_truite
cyber_truite

Reputation: 89

Symfony2 didn't display my translation

i have actually a problem when i use symfony translator. I followed the doc of Symfony2 translator and i created this repertory => myBundle/PlatformBundle/Ressources/translations and in translations i have created this file => messages.fr.yml: Hello: Bonjour I have a twig like that:

<html>
  <body>
    {{ 'Hello'|trans }} {{ name }}!
    <p> Sonate cest cool mais la trad sa lest deja moins </p>
  </body>
</html>

and i have conf my config.yml like the doc say.

Unfortunately, it's doesn't work and i don't understand why ?

Upvotes: 0

Views: 54

Answers (1)

Nico
Nico

Reputation: 3569

if you have followed french official doc for translation maybe you have set translator like this in config.yml :

framework:
    translator: { fallback: en }

Try to do like this:

framework:
    translator: { fallback: fr }

Or better like this : framework: translator: { fallback: "%locale%" }

and in this last case, edit your app/config/parameters.yml and specify the default locale like this :

parameters:
    locale: fr

If this not sufficient, then verify your directory myBundle/PlatformBundle/Ressources/translations is correct.

Upvotes: 1

Related Questions