Changeset 18528 for trunk/wp-includes/pomo/po.php
- Timestamp:
- 08/11/2011 04:29:35 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/pomo/po.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pomo/po.php
r13830 r18528 3 3 * Class for working with PO files 4 4 * 5 * @version $Id: po.php 406 2010-02-07 11:10:24Z nbachiyski $5 * @version $Id: po.php 589 2010-12-18 01:40:57Z nbachiyski $ 6 6 * @package pomo 7 7 * @subpackage po … … 19 19 if ( !class_exists( 'PO' ) ): 20 20 class PO extends Gettext_Translations { 21 21 22 var $comments_before_headers = ''; 22 23 23 24 /** … … 32 33 } 33 34 $poified = PO::poify($header_string); 34 return rtrim("msgid \"\"\nmsgstr $poified"); 35 if ($this->comments_before_headers) 36 $before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# '); 37 else 38 $before_headers = ''; 39 return rtrim("{$before_headers}msgid \"\"\nmsgstr $poified"); 35 40 } 36 41 … … 76 81 return fclose($fh); 77 82 } 83 84 /** 85 * Text to include as a comment before the start of the PO contents 86 * 87 * Doesn't need to include # in the beginning of lines, these are added automatically 88 */ 89 function set_comment_before_headers( $text ) { 90 $this->comments_before_headers = $text; 91 } 78 92 79 93 /** … … 107 121 return $po; 108 122 } 109 123 110 124 /** 111 125 * Gives back the original string from a PO-formatted string 112 * 126 * 113 127 * @static 114 128 * @param string $string PO-formatted string … … 140 154 141 155 /** 142 * Inserts $with in the beginning of every new line of $string and 156 * Inserts $with in the beginning of every new line of $string and 143 157 * returns the modified string 144 158 * … … 218 232 return $res !== false; 219 233 } 220 234 221 235 function read_entry($f, $lineno = 0) { 222 236 $entry = new Translation_Entry(); … … 255 269 } 256 270 // add comment 257 $this->add_comment_to_entry($entry, $line); 271 $this->add_comment_to_entry($entry, $line);; 258 272 } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) { 259 273 if ($is_final($context)) { … … 323 337 return array('entry' => $entry, 'lineno' => $lineno); 324 338 } 325 339 326 340 function read_line($f, $action = 'read') { 327 341 static $last_line = ''; … … 340 354 return $line; 341 355 } 342 356 343 357 function add_comment_to_entry(&$entry, $po_comment_line) { 344 358 $first_two = substr($po_comment_line, 0, 2); … … 354 368 } 355 369 } 356 370 357 371 function trim_quotes($s) { 358 372 if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
Note: See TracChangeset
for help on using the changeset viewer.