im learning Symfony 5 and was wondering if it is okay to put long strings / "messages" inside a controller (ex. addFlash message here), or there is a better way of storing them.
I think that my solution could become problematic when i try to translate my website to a different language.
class RegisterController extends AbstractController
{
public function index()
{
if ($form->isSubmitted() && $form->isValid()) {
...
$this->addFlash(
'info',
"Congratulations {$user}! You are now a part of growing <b>Symf</b> community! <br>
An activation link to <b>{$user->getEmail()}</b> was <u>not</u> sent because mailing is not implemented.
  <small>(...yet)</small>"
);
}
...
}
}
Tutorials and Symfony docs are doing it in controller but i know that might be just an example.
So my question is, is it a good practice to put long strings in variables/values in controller or is there a better way?
CodePudding user response:
It's probably a better practice to put those in a translation file. More information https://symfony.com/doc/current/translation.html