Ejemplo n.º 1
0
 protected function writeMsgstr(POString $string)
 {
     $msgstr = $string->getMsgstr();
     if ($string->getMsgidPlural() && $msgstr) {
         for ($i = 0, $length = count($msgstr); $i < $length; $i++) {
             $this->writeLine(sprintf('msgstr[%d] %s', $i, $this->quote($msgstr[$i])));
         }
     } else {
         if ($string->getMsgidPlural()) {
             $this->writeLine('msgstr[0] ""');
         } else {
             if ($msgstr) {
                 $this->writeLine(sprintf('msgstr %s', $this->quote($msgstr[0])));
             } else {
                 $this->writeLine('msgstr ""');
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Add POString instance to catalog. If identical string already exists,
  * reference and extracted comment attributes will be merged.
  */
 public function add(POString $string)
 {
     $id = $string->getMsgctxt() . "" . $string->getMsgid();
     $category = $string->getCategoryText();
     $domain = $string->getDomain();
     if (isset($this->strings[$category][$domain][$id])) {
         array_map(array($this->strings[$category][$domain][$id], 'addReference'), $string->getReferences());
         array_map(array($this->strings[$category][$domain][$id], 'addExtractedComment'), $string->getExtractedComments());
     } else {
         $this->strings[$category][$domain][$id] = $string;
     }
 }