tags:

views:

197

answers:

2

I have this widget:

$this->setWidget('slug', new sfWidgetFormDoctrineChoice(array('model' 
=> 'MyTable', 'method' => 'myMethod', 'key_method' => 'myMethod', 
'add_empty' => 'Select option'))); 

Ok, what should I do to translate the "Select option"?

I can't use the __() helper inside the form, and adding that string into my XLIFF file doesn't translate it automatically.

If it can't be done, what workaround should I implement? I can't find any way, and neither can't find any tip in the official documentation.

Thanks!

+3  A: 

I think I have solved it:

$translated_text = $this->widgetSchema->getFormFormatter()->translate('String to translate');
David
A: 

Thank you David. It works~~!

wan
You should put that as a comment of my answer ;)
David