-- buennagelj <[EMAIL PROTECTED]> wrote
(on Wednesday, 06 February 2008, 12:48 PM -0800):
> Matthew Weier O'Phinney-3 wrote:
> > 
> > -- Dividy <[EMAIL PROTECTED]> wrote
> > (on Saturday, 02 February 2008, 03:19 PM -0800):
> > Then, create your translate object:
> > 
> >     $translations = include 'path/to/translations.php';
> >     $translate = new Zend_Translate('array', $translations, 'en');
> > 
> > And pass the translation adapter to your form:
> > 
> >     $form->setTranslator($translate->getAdapter());
> > 
> This is something that stumped my yesterday: Why do I have to extract the
> Adapter from the Translator to pass it to a method called setTranslator (not
> setTranslatorAdapter)?
> 
> Wouldn't it be more obvious to just pass $translate?

The problem is that Zend_Translate does not extend
Zend_Translate_Adapter, and really, either of these (Zend_Translate or
Zend_Translate_Adapter) would be work. The issue is that you can
instantiate Zend_Translate_Adapters separate from Zend_Translate, but
Zend_Translate cannot work without one or more adapters... so I opted
for the adapter as the least common denominator.

Perhaps I can convince Thomas to create a Zend_Translate_Interface both
implement; then I could type hint to that. I'll contact him regarding
that.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to