/** * Retrieve translator object * * @return Zend_Translate_Adapter|null */ public function getTranslator() { if ($this->translatorIsDisabled()) { return null; } if (null === $this->_translator) { require_once 'Zend/Form.php'; return Zend_Form::getDefaultTranslator(); } return $this->_translator; }
/** * Retrieve localization translator object * * @return Zend_Translate_Adapter|null */ public function getTranslator() { if ($this->translatorIsDisabled()) { return null; } $translator = $this->getTransferAdapter()->getTranslator(); if (null === $translator) { //$1 'Zend/Form.php'; return Zend_Form::getDefaultTranslator(); } return $translator; }
public function testTranslatorFromRegistryUsedWhenNoneRegistered() { $this->assertNull($this->form->getTranslator()); $translator = new Zend_Translate('array', array()); Zend_Registry::set('Zend_Translate', $translator); $received = Zend_Form::getDefaultTranslator(); $this->assertSame($translator->getAdapter(), $received); $received = $this->form->getTranslator(); $this->assertSame($translator->getAdapter(), $received); $form = new Zend_Form(); $received = $form->getTranslator(); $this->assertSame($translator->getAdapter(), $received); }
/** * Retrieve localization translator object * * @return Zend_Translate_Adapter|null */ public function getTranslator() { if ($this->translatorIsDisabled()) { return null; } $translator = $this->getTransferAdapter()->getTranslator(); if (null === $translator) { require_once PHP_LIBRARY_PATH . 'Zend/Form.php'; return Zend_Form::getDefaultTranslator(); } return $translator; }