protected function createMessageTemplate($catalogue) { if ($catalogue === null) { $catalogue = 'messages'; } $variants = $this->getCatalogueList($catalogue); $variant = array_shift($variants); $mo_file = $this->getSource($variant); $po_file = $this->getPOFile($mo_file); $dir = dirname($mo_file); if (!is_dir($dir)) { @mkdir($dir); @chmod($dir, PRADO_CHMOD); } if (!is_dir($dir)) { throw new TException("Unable to create directory {$dir}"); } $po = TGettext::factory('PO', $po_file); $result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s'); $result['strings'] = array(); $po->fromArray($result); $mo = $po->toMO(); if ($po->save() && $mo->save($mo_file)) { return array($variant, $mo_file, $po_file); } else { throw new TException("Unable to create file {$po_file} and {$mo_file}"); } }