I have a Symfony2 project and I am using Translation component for translating text. I have all translations in yml file like so
As of Symfony 3, Venu's answer no longer works completely, as the translator.class parameter is no longer used.
To load your custom translator class, you now need to create a compiler pass.
getDefinition('translator.default')->setClass(Translator::class);
}
}
And this compiler pass needs to be added to the container.
addCompilerPass(new TranslatorOverridePass());
}
}