I have a problem with flash messages in Symfony 4 and translation.
Translation of simple flash messages is working fine:
But now I want to add some parameters to the flash messages and I have no idea how to handle it. I tried a lot, but nothing is working. I want to show in the flash messages the title of projects after f.e. removing. For example:
$this->addFlash('success', sprintf('flashmessage.project_deleted: %s', $project->getTitle()));
But the translation is not recognized, because the parameter is replaces before translation happens (I think so). And it should also be possible to have parameters in the middle of a string and not only at the end or at the beginning and ideally more than one parameter.
I’m using this in my Controller which extends AbstractController.
Does anybody has a solution for this?
Source: Symfony Questions