In my Symfony 1.4 project, until now, here is how I used i18n setflash messages in my actions :
$message = $this->getContext()->getI18N()->__('message’);
$this->getUser()->setFlash('notice', $message);
but I’ve just found a simplest way. Here the code I use in my projectconfiguration class :
public function setup()
{
$this->loadHelpers(array('I18N'));
}
and then here the code I use in my actions :
$this->getUser()->setFlash('error', __('message'));
for me, it is very convenient because I don’t have to use the getContext->getI18N everywhere but I would like to know if there is a drawback using this method ?
I always use this method in many projects and I didn’t see any drawbacks.
Helpers are here to give us a library of useful functions. Some helper’s functions return html so (impov) they are dedicated to the template, but in case of I18N or Date, it can be useful to have them in an action.
And if you don’t want to load your helper in a global view, you can use: