Changeset 57734
- Timestamp:
- 02/28/2024 09:29:03 AM (5 months ago)
- Location:
- trunk/src/wp-includes/pomo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/entry.php
r56548 r57734 11 11 /** 12 12 * Translation_Entry class encapsulates a translatable string. 13 14 13 15 */ 14 16 #[AllowDynamicProperties] … … 76 78 * PHP4 constructor. 77 79 * 80 78 81 * @deprecated 5.4.0 Use __construct() instead. 79 82 * … … 87 90 /** 88 91 * Generates a unique key for this entry. 92 93 89 94 * 90 95 * @return string|false The key or false if the entry is null. … … 104 109 105 110 /** 106 * @param object $other 111 * Merges another translation entry with the current one. 112 * 113 * @since 2.8.0 114 * 115 * @param Translation_Entry $other Other translation entry. 107 116 */ 108 117 public function merge_with( &$other ) { -
trunk/src/wp-includes/pomo/translations.php
r57162 r57734 6 6 * @package pomo 7 7 * @subpackage translations 8 8 9 */ 9 10 … … 12 13 13 14 if ( ! class_exists( 'Translations', false ) ) : 15 16 17 18 19 14 20 #[AllowDynamicProperties] 15 21 class Translations { 22 23 24 25 26 27 28 16 29 public $entries = array(); 30 31 32 33 34 35 36 37 17 38 public $headers = array(); 18 39 19 40 /** 20 * Add entry to the PO structure 41 * Adds an entry to the PO structure. 42 * 43 * @since 2.8.0 21 44 * 22 45 * @param array|Translation_Entry $entry 23 * @return bool true on success, false if the entry doesn't have a key46 * @return bool 24 47 */ 25 48 public function add_entry( $entry ) { … … 36 59 37 60 /** 61 62 63 64 38 65 * @param array|Translation_Entry $entry 39 * @return bool 66 * @return bool 40 67 */ 41 68 public function add_entry_or_merge( $entry ) { … … 62 89 * TODO: this should be out of this class, it is gettext specific 63 90 * 91 92 64 93 * @param string $header header name, without trailing : 65 94 * @param string $value header value, without trailing \n … … 70 99 71 100 /** 72 * @param array $headers 101 * Sets translation headers. 102 * 103 * @since 2.8.0 104 * 105 * @param array $headers Associative array of headers. 73 106 */ 74 107 public function set_headers( $headers ) { … … 79 112 80 113 /** 114 115 116 117 81 118 * @param string $header 119 82 120 */ 83 121 public function get_header( $header ) { … … 86 124 87 125 /** 88 * @param Translation_Entry $entry 126 * Returns a given translation entry. 127 * 128 * @since 2.8.0 129 * 130 * @param Translation_Entry $entry Translation entry. 131 * @return Translation_Entry|false Translation entry if it exists, false otherwise. 89 132 */ 90 133 public function translate_entry( &$entry ) { … … 94 137 95 138 /** 139 140 141 142 96 143 * @param string $singular 97 144 * @param string $context … … 118 165 * from their headers. 119 166 * 120 * @param int $count number of items 167 * @since 2.8.0 168 * 169 * @param int $count Number of items. 170 * @return int Plural form to use. 121 171 */ 122 172 public function select_plural_form( $count ) { … … 125 175 126 176 /** 127 * @return int 177 * Returns the plural forms count. 178 * 179 * @since 2.8.0 180 * 181 * @return int Plural forms count. 128 182 */ 129 183 public function get_plural_forms_count() { … … 132 186 133 187 /** 188 189 190 191 134 192 * @param string $singular 135 193 * @param string $plural 136 194 * @param int $count 137 195 * @param string $context 196 138 197 */ 139 198 public function translate_plural( $singular, $plural, $count, $context = null ) { … … 158 217 159 218 /** 160 * Merge $other in the current object. 161 * 162 * @param Object $other Another Translation object, whose translations will be merged in this one (passed by reference). 219 * Merges other translations into the current one. 220 * 221 * @since 2.8.0 222 * 223 * @param Translations $other Another Translation object, whose translations will be merged in this one (passed by reference). 163 224 */ 164 225 public function merge_with( &$other ) { … … 169 230 170 231 /** 171 * @param object $other 232 * Merges originals with existing entries. 233 * 234 * @since 2.8.0 235 * 236 * @param Translations $other 172 237 */ 173 238 public function merge_originals_with( &$other ) { … … 182 247 } 183 248 249 250 251 252 253 184 254 class Gettext_Translations extends Translations { 185 255 … … 188 258 * 189 259 * @var int 260 261 190 262 */ 191 263 public $_nplurals; … … 195 267 * 196 268 * @var callable 269 270 197 271 */ 198 272 public $_gettext_select_plural_form; … … 201 275 * The gettext implementation of select_plural_form. 202 276 * 203 * It lives in this class, because there are more than one descendan d, which will use it and277 * It lives in this class, because there are more than one descendan, which will use it and 204 278 * they can't share it effectively. 205 279 * 206 * @param int $count 280 * @since 2.8.0 281 * 282 * @param int $count Plural forms count. 283 * @return int Plural form to use. 207 284 */ 208 285 public function gettext_select_plural_form( $count ) { … … 216 293 217 294 /** 295 296 297 298 218 299 * @param string $header 219 * @return array 300 * @return array 220 301 */ 221 302 public function nplurals_and_expression_from_header( $header ) { … … 231 312 /** 232 313 * Makes a function, which will return the right translation index, according to the 233 * plural forms header 314 * plural forms header. 315 * 316 * @since 2.8.0 234 317 * 235 318 * @param int $nplurals 236 319 * @param string $expression 320 237 321 */ 238 322 public function make_plural_form_function( $nplurals, $expression ) { … … 250 334 * plural expressions, because PHP evaluates ternary operators from left to right 251 335 * 336 252 337 * @deprecated 6.5.0 Use the Plural_Forms class instead. 338 253 339 * @see Plural_Forms 254 340 * … … 282 368 283 369 /** 370 371 372 373 284 374 * @param string $translation 285 * @return array 375 * @return array 286 376 */ 287 377 public function make_headers( $translation ) { … … 301 391 302 392 /** 393 394 395 396 303 397 * @param string $header 304 398 * @param string $value … … 317 411 if ( ! class_exists( 'NOOP_Translations', false ) ) : 318 412 /** 319 * Provides the same interface as Translations, but doesn't do anything 413 * Provides the same interface as Translations, but doesn't do anything. 414 * 415 * @since 2.8.0 320 416 */ 321 417 #[AllowDynamicProperties] 322 418 class NOOP_Translations { 419 420 421 422 423 424 425 323 426 public $entries = array(); 427 428 429 430 431 432 433 434 324 435 public $headers = array(); 325 436 … … 329 440 330 441 /** 442 443 444 445 331 446 * @param string $header 332 447 * @param string $value … … 336 451 337 452 /** 453 454 455 456 338 457 * @param array $headers 339 458 */ … … 342 461 343 462 /** 463 464 465 466 344 467 * @param string $header 345 468 * @return false … … 350 473 351 474 /** 475 476 477 478 352 479 * @param Translation_Entry $entry 353 480 * @return false … … 358 485 359 486 /** 487 488 489 490 360 491 * @param string $singular 361 492 * @param string $context … … 366 497 367 498 /** 499 500 501 502 368 503 * @param int $count 369 * @return bool504 * @return 370 505 */ 371 506 public function select_plural_form( $count ) { … … 374 509 375 510 /** 511 512 513 514 376 515 * @return int 377 516 */ … … 381 520 382 521 /** 522 523 524 525 383 526 * @param string $singular 384 527 * @param string $plural 385 528 * @param int $count 386 529 * @param string $context 530 387 531 */ 388 532 public function translate_plural( $singular, $plural, $count, $context = null ) { … … 391 535 392 536 /** 393 * @param object $other 537 * Merges other translations into the current one. 538 * 539 * @since 2.8.0 540 * 541 * @param Translations $other 394 542 */ 395 543 public function merge_with( &$other ) {
Note: See TracChangeset
for help on using the changeset viewer.