Example #1
0
 /**
  * Write an empty POT file containing all strings found
  *
  * @param string $file File to write to
  */
 public function writePot($file)
 {
     $output = "# Copyright (C) " . date("Y") . " Next Buzz" . PHP_EOL . "msgid \"\"" . PHP_EOL . "msgstr \"\"" . PHP_EOL . "\"Project-Id-Version: buzz-seo\\n\"" . PHP_EOL . "\"POT-Creation-Date: " . date("Y-m-d H:i:sO") . "\\n\"" . PHP_EOL . "\"MIME-Version: 1.0\\n\"" . PHP_EOL . "\"Content-Type: text/plain; charset=UTF-8\\n\"" . PHP_EOL . "\"Content-Transfer-Encoding: 8bit\\n\"" . PHP_EOL . "\"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\\n\"" . PHP_EOL . "\"Language-Team: Next Buzz, Bas de Kort <*****@*****.**>\\n\"" . PHP_EOL . PHP_EOL;
     require_once ABSPATH . '/wp-includes/pomo/po.php';
     $poifyString = new \PO();
     foreach ($this->findings as $translatable => $locations) {
         $output .= "#:";
         foreach ($locations as $line => $location) {
             $output .= " " . $location . ":" . $line;
         }
         $output .= PHP_EOL . "msgid " . $poifyString->poify(StringParser::factory($translatable)->trimMultiline()) . PHP_EOL . "msgstr \"\"" . PHP_EOL . PHP_EOL;
     }
     file_put_contents($file, $output);
 }