Zach Starnes
Zach Starnes

Reputation: 3198

Child bundle not overriding parent bundle translations

I am trying to override the translations in the default FOSUserBundle.en.yml. I have my User bundle as a child of the FOSUserBundle using the getParent method and I copied the FOSUserBundle.en.yml into the translations folder of the child bundle and nothing is being overridden. Can someone help me find out why this is?

I know I have to be missing something because I was able to override the layout.html.twig file easily doing the same thing.

I tried using php app/console cache:clear and that did not help.

Upvotes: 0

Views: 107

Answers (2)

Zach Starnes
Zach Starnes

Reputation: 3198

It turned out that the translation file was overriding but the FOSUserBundle was after the child bundle in the AppKernel file. Because of how translations work the translation file from the FOSUserBundle was being loaded after the childs translation file, in turn overriding the child.

All I had to do was move the child bundle in the AppKernel file after the parent. This way it was the last translation file to be loaded.

Here is the documentation page I found this at: http://symfony.com/doc/current/cookbook/bundles/override.html#override-translations

Upvotes: 1

Johnny
Johnny

Reputation: 679

I've run into this before as well. Try manually deleting your cache/dev directory. I'm guessing your talking about the dev environment as cache:clear without parameters defaults to dev.

Upvotes: 0

Related Questions