On Feb 16, 10:22 am, David Herrmann <[email protected]> wrote:
> Iltar schrieb:
>
> > When i want a custom message for like a form error:
> > array(
> >    'min_length' => __('Your username cannot contain less then 6
> > characters.'),
> >    'max_length' => __('Your username cannot contain more than 32
> > characters.')
> > )
>
> > The __() ofcourse doesn't work... How can i insert an english but make
> > it translatable?
>
> You may load i18n like this:
>
> $i18n = sfContext::getInstance()->getI18N();
> array(
>    'min_length' => $i18n->__('Your username cannot contain less then 6
> characters.'),
>    'max_length' => $i18n->__('Your username cannot contain more than 32
> characters.')
> )
>
> Of course it might be better to place as many texts as possible in the
> view layer, but sometimes this is the only valid option.
>
> David

Or you can directly load the helper anywhere: sfLoader::loadHelpers
(array('I18N'));

and then use the __() function/helper
--~--~---------~--~----~------------~-------~--~----~
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