Changeset 18528 for trunk/wp-includes/pomo/translations.php
- Timestamp:
- 08/11/2011 04:29:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pomo/translations.php
r13830 r18528 3 3 * Class for a set of entries for translation and their associated headers 4 4 * 5 * @version $Id: translations.php 406 2010-02-07 11:10:24Z nbachiyski $5 * @version $Id: translations.php 590 2010-12-20 19:58:37Z nbachiyski $ 6 6 * @package pomo 7 7 * @subpackage translations … … 28 28 if (false === $key) return false; 29 29 $this->entries[$key] = &$entry; 30 return true; 31 } 32 33 function add_entry_or_merge($entry) { 34 if (is_array($entry)) { 35 $entry = new Translation_Entry($entry); 36 } 37 $key = $entry->key(); 38 if (false === $key) return false; 39 if (isset($this->entries[$key])) 40 $this->entries[$key]->merge_with($entry); 41 else 42 $this->entries[$key] = &$entry; 30 43 return true; 31 44 } … … 109 122 } 110 123 } 124 125 function merge_originals_with(&$other) { 126 foreach( $other->entries as $entry ) { 127 if ( !isset( $this->entries[$entry->key()] ) ) 128 $this->entries[$entry->key()] = $entry; 129 else 130 $this->entries[$entry->key()]->merge_with($entry); 131 } 132 } 111 133 } 112 134 … … 127 149 return call_user_func($this->_gettext_select_plural_form, $count); 128 150 } 129 151 130 152 function nplurals_and_expression_from_header($header) { 131 153 if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) { … … 153 175 * Adds parantheses to the inner parts of ternary operators in 154 176 * plural expressions, because PHP evaluates ternary oerators from left to right 155 * 177 * 156 178 * @param string $expression the expression without parentheses 157 179 * @return string the expression with parentheses added … … 181 203 return rtrim($res, ';'); 182 204 } 183 205 184 206 function make_headers($translation) { 185 207 $headers = array(); … … 194 216 return $headers; 195 217 } 196 218 197 219 function set_header($header, $value) { 198 220 parent::set_header($header, $value); … … 213 235 var $entries = array(); 214 236 var $headers = array(); 215 237 216 238 function add_entry($entry) { 217 239 return true;
Note: See TracChangeset
for help on using the changeset viewer.