load() public method

Load PO file
public load ( string $file = null ) : mixed
$file string
return mixed Returns true on success or PEAR_Error on failure.
Example #1
0
 /**
  * poFile2moFile
  *
  * That's a simple fake of the 'msgfmt' console command.  It reads the
  * contents of a GNU PO file and saves them to a GNU MO file.
  *
  * @static
  * @access  public
  * @return  mixed   Returns true on success or PEAR_Error on failure.
  * @param   string  $pofile path to GNU PO file
  * @param   string  $mofile path to GNU MO file
  */
 static function poFile2moFile($pofile, $mofile)
 {
     if (!is_file($pofile)) {
         throw new Exception("File {$pofile} doesn't exist.");
     }
     include_once dirname(__FILE__) . '/PO.php';
     $PO = new TGettext_PO($pofile);
     if (true !== ($e = $PO->load())) {
         return $e;
     }
     $MO = $PO->toMO();
     if (true !== ($e = $MO->save($mofile))) {
         return $e;
     }
     unset($PO, $MO);
     return true;
 }