Reputation: 2679
I'm using Symfony2.6 and this is the catalogue of translation but it doesn't work
message.en.yml
#src/AppBundle/Resources/translations/message.en.yml
app:
menu:
home: Home
message.fr.yml
#src/AppBundle/Resources/translations/message.fr.yml
app:
menu:
home: Accueil
And this is the twig
{{ 'app.menu.home'|trans }}
this is the output
APP.MENU.HOME
Upvotes: 0
Views: 356
Reputation: 971
Your translator file name might be messages.fr.yml you named it message.fr.yml the default translation domain is messges if you use any other translator file name , in your twig file you can translate in 2 way:
{% trans_default_domain "mytrans"%}
Upvotes: 1
Reputation: 7586
Your translation namespace is not correct (the final s of message is missing), the files should be named:
#src/AppBundle/Resources/translations/messages.en.yml
#src/AppBundle/Resources/translations/messages.fr.yml
Or call the trans helper with the message
namespace:
{{ 'app.menu.home'|trans({},'message') }
Upvotes: 2
Reputation: 4265
What you did seems correct so there's probably a typo somewhere. Check carefully the YML file syntax and spaces, it's easy to mess it up.
Upvotes: 0