예제 #1
0
    /**
     * 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;
    }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
    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);
    }
예제 #4
0
파일: File.php 프로젝트: netixx/Stock
 /**
  * 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;
 }