Ideally you pass the I18N instance into the form. That way you don't
couple your forms to the context (makes forms hard to test).

For example, from within an action you can say:

$form = new WhateverForm(array(), array("i18n" => $this ->
getContext() -> getI18n()));

and inside the form:

$i18n = $this -> getOption("i18n");
$i18n -> __(...)

Same with routing..

Daniel


On Jun 21, 7:55 am, Guychmyrat Amanmyradov <guychmy...@yahoo.com.tr>
wrote:
> try this :
>
> sfContext::getInstance()->getI18n()->__('text);
>
> --- 21/06/10 Pzt tarihinde HAUSa <jeroen_heeft_behoefte_aan_r...@hotmail.com> 
> şöyle yazıyor:
>
> Kimden: HAUSa <jeroen_heeft_behoefte_aan_r...@hotmail.com>
> Konu: [symfony-users] Translation in form class
> Kime: "symfony users" <symfony-users@googlegroups.com>
> Tarihi: 21 Haziran 2010 Pazartesi, 17:43
>
> How can I get a I18n translation in my form class?
> I want to use the __() function in my UserForm.class.php.
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to