Hi,

The __() we define is just a proxy. there is no other way (at my
knowledge) to access I18n from the forms without going through the
context.
I don't see any violation here, as the forms stand between the action
and the model.

Regards,
Cedric

On Jan 12, 4:59 pm, google <[email protected]> wrote:
> Thanks. This works.
>
> But it doesn't seem very clean to have to define the __() and getI18N
> () methods in the Form. Is there a better place to define these static
> choice strings? To me it appears that they are part of the model.
>
> Regards,
>
> René
>
> Cédric Sadai wrote:
> > $w['stuff'] = new sfWidgetFormSelect( array('choices' => array('draft'
> > => $this->__('draft'), 'published' => $this->__('published'))) );
>
> > protected function __($string, $args = array(), $catalogue =
> > 'messages')
> > {
> >     return $this->getI18N()->__($string, $args, $catalogue);
> > }
>
> > protected function getI18N()
> > {
> >     return sfContext::getInstance()->getI18N();
> > }
>
> > If you really want to define your static choices in your model, I
> > would consider smthg like
>
> > $choices = DemoArticlePeer::getStatusChoices();
> > $i18nChoices = array_map(array($this, '__'), $choices);
>
> > hope this helps,
>
> > Cheers,
>
> > Cedric
> >http://sadai.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to