示例#1
0
 /**
  * Add parsed message to list of found messages
  *
  * @param string $sourceMessage
  * @param Gpf_Io_File $file
  * @param $type Type of message (server/client/both)
  */
 private function addMessage($sourceMessage, Gpf_Io_File $file, $type)
 {
     if (in_array($file->getExtension(), array('java', 'php'))) {
         @eval("\$sourceMessage = {$sourceMessage};");
     }
     if (!strlen($sourceMessage)) {
         throw new Gpf_Exception($this->_('Source message can\'t be empty in file %s', $file->getFileName()));
     }
     $translation = new Gpf_Lang_Parser_Translation();
     $translation->setSourceMessage($sourceMessage);
     if (array_key_exists($translation->getId(), $this->sourceTranslations)) {
         $translation = $this->sourceTranslations[$translation->getId()];
     }
     $translation->setCustomerSpecific(false);
     $translation->setType($type);
     $translation->addModule($this->handler->getModule($file));
     $this->sourceTranslations[$translation->getId()] = $translation;
 }
 /**
  * Return true if translation is already in array of translations
  *
  * @param Gpf_Lang_Parser_Translation $translation
  * @return boolean
  */
 public function existTranslation(Gpf_Lang_Parser_Translation $translation)
 {
     return array_key_exists($translation->getId(), $this->translations);
 }