Changeset 57734
- Timestamp:
- 02/28/2024 09:29:03 AM (8 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 * @since 2.8.0 13 15 */ 14 16 #[AllowDynamicProperties] … … 76 78 * PHP4 constructor. 77 79 * 80 * @since 2.8.0 78 81 * @deprecated 5.4.0 Use __construct() instead. 79 82 * … … 87 90 /** 88 91 * Generates a unique key for this entry. 92 * 93 * @since 2.8.0 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 * @since 2.8.0 8 9 */ 9 10 … … 12 13 13 14 if ( ! class_exists( 'Translations', false ) ) : 15 /** 16 * Translations class. 17 * 18 * @since 2.8.0 19 */ 14 20 #[AllowDynamicProperties] 15 21 class Translations { 22 /** 23 * List of translation entries. 24 * 25 * @since 2.8.0 26 * 27 * @var Translation_Entry[] 28 */ 16 29 public $entries = array(); 30 31 /** 32 * List of translation headers. 33 * 34 * @since 2.8.0 35 * 36 * @var array<string, string> 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 True on success, false if the entry doesn't have a key. 24 47 */ 25 48 public function add_entry( $entry ) { … … 36 59 37 60 /** 61 * Adds or merges an entry to the PO structure. 62 * 63 * @since 2.8.0 64 * 38 65 * @param array|Translation_Entry $entry 39 * @return bool 66 * @return bool True on success, false if the entry doesn't have a key. 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 * @since 2.8.0 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 * Returns a given translation header. 115 * 116 * @since 2.8.0 117 * 81 118 * @param string $header 119 * @return string|false Header if it exists, false otherwise. 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 * Translates a singular string. 140 * 141 * @since 2.8.0 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 * Translates a plural string. 189 * 190 * @since 2.8.0 191 * 134 192 * @param string $singular 135 193 * @param string $plural 136 194 * @param int $count 137 195 * @param string $context 196 * @return string 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 * Gettext_Translations class. 251 * 252 * @since 2.8.0 253 */ 184 254 class Gettext_Translations extends Translations { 185 255 … … 188 258 * 189 259 * @var int 260 * 261 * @since 2.8.0 190 262 */ 191 263 public $_nplurals; … … 195 267 * 196 268 * @var callable 269 * 270 * @since 2.8.0 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 descendant, 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 * Returns the nplurals and plural forms expression from the Plural-Forms header. 296 * 297 * @since 2.8.0 298 * 218 299 * @param string $header 219 * @return array 300 * @return array{0: int, 1: string} 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 * @return callable 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 * @since 2.8.0 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 * Prepare translation headers. 371 * 372 * @since 2.8.0 373 * 284 374 * @param string $translation 285 * @return array 375 * @return array<string, string> Translation headers 286 376 */ 287 377 public function make_headers( $translation ) { … … 301 391 302 392 /** 393 * Sets translation headers. 394 * 395 * @since 2.8.0 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 * List of translation entries. 421 * 422 * @since 2.8.0 423 * 424 * @var Translation_Entry[] 425 */ 323 426 public $entries = array(); 427 428 /** 429 * List of translation headers. 430 * 431 * @since 2.8.0 432 * 433 * @var array<string, string> 434 */ 324 435 public $headers = array(); 325 436 … … 329 440 330 441 /** 442 * Sets a translation header. 443 * 444 * @since 2.8.0 445 * 331 446 * @param string $header 332 447 * @param string $value … … 336 451 337 452 /** 453 * Sets translation headers. 454 * 455 * @since 2.8.0 456 * 338 457 * @param array $headers 339 458 */ … … 342 461 343 462 /** 463 * Returns a translation header. 464 * 465 * @since 2.8.0 466 * 344 467 * @param string $header 345 468 * @return false … … 350 473 351 474 /** 475 * Returns a given translation entry. 476 * 477 * @since 2.8.0 478 * 352 479 * @param Translation_Entry $entry 353 480 * @return false … … 358 485 359 486 /** 487 * Translates a singular string. 488 * 489 * @since 2.8.0 490 * 360 491 * @param string $singular 361 492 * @param string $context … … 366 497 367 498 /** 499 * Returns the plural form to use. 500 * 501 * @since 2.8.0 502 * 368 503 * @param int $count 369 * @return bool504 * @return int 370 505 */ 371 506 public function select_plural_form( $count ) { … … 374 509 375 510 /** 511 * Returns the plural forms count. 512 * 513 * @since 2.8.0 514 * 376 515 * @return int 377 516 */ … … 381 520 382 521 /** 522 * Translates a plural string. 523 * 524 * @since 2.8.0 525 * 383 526 * @param string $singular 384 527 * @param string $plural 385 528 * @param int $count 386 529 * @param string $context 530 * @return string 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.