示例#1
0
 /**
  * Translation object setup
  */
 public function setTranslationObject()
 {
     // set language
     if (isset($this->requestLang)) {
         $lg = $this->requestLang;
     } else {
         $lg = $this->config->general->lang;
     }
     if ($lg == '' || !$lg) {
         $lg = 'en';
     }
     $this->registry->set('language', $lg);
     $translate = new Zend_Translate('csv', $this->corePath . '/application/language/en.csv', $this->config->general->lang);
     $translate->setLocale($this->config->general->locale);
     Zend_Validate_Abstract::setDefaultTranslator($translate);
     Zend_Form::setDefaultTranslator($translate);
     $this->registry->set('Zend_Translate', $translate);
     $path1 = $this->corePath . '/application/language/';
     $path2 = Sydney_Tools::getLocalPath() . '/application/language/';
     // general global translations
     if (is_dir($path1) && file_exists($path1 . $lg . '.csv')) {
         $translate->addTranslation($path1 . $lg . '.csv', $lg);
     }
     if (is_dir($path2) && file_exists($path2 . $lg . '.csv')) {
         $translate->addTranslation($path2 . $lg . '.csv', $lg);
     }
     // Create a log instance
     if ($this->debugTranslationsNotFound) {
         $writer = new Zend_Log_Writer_Stream(Sydney_Tools_Paths::getLogPath() . '/' . $lg . '-translation-notfound.log');
         $log = new Zend_Log($writer);
         // Attach it to the translation instance
         $translate->setOptions(array('log' => $log, 'logUntranslated' => $this->config->general->env != 'PROD'));
     }
 }
示例#2
0
 /**
  * Logs data to file for debug purpose
  * @param string $message
  * @param string $file
  * @return bool
  */
 protected function _logToFile($message = '', $file = 'Sydney_Medias_Filestypes.log')
 {
     if (!$this->_debug) {
         return false;
     }
     $c = date('Ymd H:i:s') . ';' . $this->filename . ';' . $this->extension . ';"' . $message . '"' . "\n";
     file_put_contents(Sydney_Tools_Paths::getLogPath() . '/' . $file, $c, FILE_APPEND);
     return true;
 }