Changeset 30663
- Timestamp:
- 11/30/2014 09:40:53 PM (10 years ago)
- Location:
- trunk/src/wp-includes/pomo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/mo.php
r28806 r30663 140 140 } 141 141 142 143 144 142 145 function import_from_reader($reader) { 143 146 $endian_string = MO::get_byteorder($reader->readint32()); -
trunk/src/wp-includes/pomo/po.php
r26500 r30663 190 190 * 191 191 * @static 192 * @param object&$entry the entry to convert to po string193 * @return string|boolPO-style formatted string for the entry or192 * @param &$entry the entry to convert to po string 193 * @return PO-style formatted string for the entry or 194 194 * false if the entry is empty 195 195 */ … … 216 216 } 217 217 218 219 220 221 218 222 function import_from_file($filename) { 219 223 $f = fopen($filename, 'r'); … … 239 243 } 240 244 245 246 247 248 249 241 250 function read_entry($f, $lineno = 0) { 242 251 $entry = new Translation_Entry(); … … 344 353 } 345 354 355 356 357 358 359 360 361 346 362 function read_line($f, $action = 'read') { 347 363 static $last_line = ''; … … 362 378 } 363 379 380 381 382 383 364 384 function add_comment_to_entry(&$entry, $po_comment_line) { 365 385 $first_two = substr($po_comment_line, 0, 2); … … 376 396 } 377 397 398 399 400 401 378 402 function trim_quotes($s) { 379 403 if ( substr($s, 0, 1) == '"') $s = substr($s, 1); -
trunk/src/wp-includes/pomo/streams.php
r22349 r30663 59 59 } 60 60 61 61 /** 62 * @param string $string 63 * @param int $start 64 * @param int $length 65 * @return string 66 */ 62 67 function substr($string, $start, $length) { 63 68 if ($this->is_overloaded) { … … 68 73 } 69 74 75 76 77 78 70 79 function strlen($string) { 71 80 if ($this->is_overloaded) { … … 76 85 } 77 86 87 88 89 90 91 78 92 function str_split($string, $chunk_size) { 79 93 if (!function_exists('str_split')) { … … 105 119 if ( !class_exists( 'POMO_FileReader' ) ): 106 120 class POMO_FileReader extends POMO_Reader { 121 122 123 124 107 125 function POMO_FileReader($filename) { 108 126 parent::POMO_Reader(); … … 110 128 } 111 129 130 131 132 112 133 function read($bytes) { 113 134 return fread($this->_f, $bytes); 114 135 } 115 136 137 138 139 140 116 141 function seekto($pos) { 117 142 if ( -1 == fseek($this->_f, $pos, SEEK_SET)) { … … 158 183 } 159 184 160 185 /** 186 * @param string $bytes 187 * @return string 188 */ 161 189 function read($bytes) { 162 190 $data = $this->substr($this->_str, $this->_pos, $bytes); … … 166 194 } 167 195 196 197 198 199 168 200 function seekto($pos) { 169 201 $this->_pos = $pos; -
trunk/src/wp-includes/pomo/translations.php
r29479 r30663 18 18 * Add entry to the PO structure 19 19 * 20 * @param object&$entry20 * @param &$entry 21 21 * @return bool true on success, false if the entry doesn't have a key 22 22 */ … … 31 31 } 32 32 33 34 35 36 33 37 function add_entry_or_merge($entry) { 34 38 if (is_array($entry)) { … … 58 62 } 59 63 64 65 66 60 67 function set_headers($headers) { 61 68 foreach($headers as $header => $value) { … … 64 71 } 65 72 73 74 75 66 76 function get_header($header) { 67 77 return isset($this->headers[$header])? $this->headers[$header] : false; 68 78 } 69 79 80 81 82 70 83 function translate_entry(&$entry) { 71 84 $key = $entry->key(); … … 73 86 } 74 87 88 89 90 91 92 75 93 function translate($singular, $context=null) { 76 94 $entry = new Translation_Entry(array('singular' => $singular, 'context' => $context)); … … 98 116 } 99 117 118 119 120 121 122 123 100 124 function translate_plural($singular, $plural, $count, $context = null) { 101 125 $entry = new Translation_Entry(array('singular' => $singular, 'plural' => $plural, 'context' => $context)); … … 140 164 * they can't share it effectively. 141 165 * 166 142 167 */ 143 168 function gettext_select_plural_form($count) { … … 150 175 } 151 176 177 178 179 180 152 181 function nplurals_and_expression_from_header($header) { 153 182 if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) { … … 163 192 * Makes a function, which will return the right translation index, according to the 164 193 * plural forms header 194 195 165 196 */ 166 197 function make_plural_form_function($nplurals, $expression) { … … 204 235 } 205 236 237 238 239 240 206 241 function make_headers($translation) { 207 242 $headers = array(); … … 217 252 } 218 253 254 255 256 257 219 258 function set_header($header, $value) { 220 259 parent::set_header($header, $value); … … 254 293 } 255 294 295 296 297 298 256 299 function translate($singular, $context=null) { 257 300 return $singular; … … 266 309 } 267 310 311 312 313 314 315 316 268 317 function translate_plural($singular, $plural, $count, $context = null) { 269 318 return 1 == $count? $singular : $plural;
Note: See TracChangeset
for help on using the changeset viewer.