Changeset 51919 for trunk/src/wp-includes/pomo/translations.php
- Timestamp:
- 10/18/2021 05:51:17 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/translations.php
r49184 r51919 22 22 * @return bool true on success, false if the entry doesn't have a key 23 23 */ 24 function add_entry( $entry ) {24 public function add_entry( $entry ) { 25 25 if ( is_array( $entry ) ) { 26 26 $entry = new Translation_Entry( $entry ); … … 38 38 * @return bool 39 39 */ 40 function add_entry_or_merge( $entry ) {40 public function add_entry_or_merge( $entry ) { 41 41 if ( is_array( $entry ) ) { 42 42 $entry = new Translation_Entry( $entry ); … … 64 64 * @param string $value header value, without trailing \n 65 65 */ 66 function set_header( $header, $value ) {66 public function set_header( $header, $value ) { 67 67 $this->headers[ $header ] = $value; 68 68 } … … 71 71 * @param array $headers 72 72 */ 73 function set_headers( $headers ) {73 public function set_headers( $headers ) { 74 74 foreach ( $headers as $header => $value ) { 75 75 $this->set_header( $header, $value ); … … 80 80 * @param string $header 81 81 */ 82 function get_header( $header ) {82 public function get_header( $header ) { 83 83 return isset( $this->headers[ $header ] ) ? $this->headers[ $header ] : false; 84 84 } … … 87 87 * @param Translation_Entry $entry 88 88 */ 89 function translate_entry( &$entry ) {89 public function translate_entry( &$entry ) { 90 90 $key = $entry->key(); 91 91 return isset( $this->entries[ $key ] ) ? $this->entries[ $key ] : false; … … 97 97 * @return string 98 98 */ 99 function translate( $singular, $context = null ) {99 public function translate( $singular, $context = null ) { 100 100 $entry = new Translation_Entry( 101 101 array( … … 119 119 * @param int $count number of items 120 120 */ 121 function select_plural_form( $count ) {121 public function select_plural_form( $count ) { 122 122 return 1 == $count ? 0 : 1; 123 123 } … … 126 126 * @return int 127 127 */ 128 function get_plural_forms_count() {128 public function get_plural_forms_count() { 129 129 return 2; 130 130 } … … 136 136 * @param string $context 137 137 */ 138 function translate_plural( $singular, $plural, $count, $context = null ) {138 public function translate_plural( $singular, $plural, $count, $context = null ) { 139 139 $entry = new Translation_Entry( 140 140 array( … … 162 162 * @return void 163 163 */ 164 function merge_with( &$other ) {164 public function merge_with( &$other ) { 165 165 foreach ( $other->entries as $entry ) { 166 166 $this->entries[ $entry->key() ] = $entry; … … 171 171 * @param object $other 172 172 */ 173 function merge_originals_with( &$other ) {173 public function merge_originals_with( &$other ) { 174 174 foreach ( $other->entries as $entry ) { 175 175 if ( ! isset( $this->entries[ $entry->key() ] ) ) { … … 191 191 * @param int $count 192 192 */ 193 function gettext_select_plural_form( $count ) {193 public function gettext_select_plural_form( $count ) { 194 194 if ( ! isset( $this->_gettext_select_plural_form ) || is_null( $this->_gettext_select_plural_form ) ) { 195 195 list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header( $this->get_header( 'Plural-Forms' ) ); … … 204 204 * @return array 205 205 */ 206 function nplurals_and_expression_from_header( $header ) {206 public function nplurals_and_expression_from_header( $header ) { 207 207 if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) { 208 208 $nplurals = (int) $matches[1]; … … 221 221 * @param string $expression 222 222 */ 223 function make_plural_form_function( $nplurals, $expression ) {223 public function make_plural_form_function( $nplurals, $expression ) { 224 224 try { 225 225 $handler = new Plural_Forms( rtrim( $expression, ';' ) ); … … 238 238 * @return string the expression with parentheses added 239 239 */ 240 function parenthesize_plural_exression( $expression ) {240 public function parenthesize_plural_exression( $expression ) { 241 241 $expression .= ';'; 242 242 $res = ''; … … 267 267 * @return array 268 268 */ 269 function make_headers( $translation ) {269 public function make_headers( $translation ) { 270 270 $headers = array(); 271 271 // Sometimes \n's are used instead of real new lines. … … 286 286 * @param string $value 287 287 */ 288 function set_header( $header, $value ) {288 public function set_header( $header, $value ) { 289 289 parent::set_header( $header, $value ); 290 290 if ( 'Plural-Forms' === $header ) { … … 305 305 public $headers = array(); 306 306 307 function add_entry( $entry ) {307 public function add_entry( $entry ) { 308 308 return true; 309 309 } … … 313 313 * @param string $value 314 314 */ 315 function set_header( $header, $value ) {315 public function set_header( $header, $value ) { 316 316 } 317 317 … … 319 319 * @param array $headers 320 320 */ 321 function set_headers( $headers ) {321 public function set_headers( $headers ) { 322 322 } 323 323 … … 326 326 * @return false 327 327 */ 328 function get_header( $header ) {328 public function get_header( $header ) { 329 329 return false; 330 330 } … … 334 334 * @return false 335 335 */ 336 function translate_entry( &$entry ) {336 public function translate_entry( &$entry ) { 337 337 return false; 338 338 } … … 342 342 * @param string $context 343 343 */ 344 function translate( $singular, $context = null ) {344 public function translate( $singular, $context = null ) { 345 345 return $singular; 346 346 } … … 350 350 * @return bool 351 351 */ 352 function select_plural_form( $count ) {352 public function select_plural_form( $count ) { 353 353 return 1 == $count ? 0 : 1; 354 354 } … … 357 357 * @return int 358 358 */ 359 function get_plural_forms_count() {359 public function get_plural_forms_count() { 360 360 return 2; 361 361 } … … 367 367 * @param string $context 368 368 */ 369 function translate_plural( $singular, $plural, $count, $context = null ) {369 public function translate_plural( $singular, $plural, $count, $context = null ) { 370 370 return 1 == $count ? $singular : $plural; 371 371 } … … 374 374 * @param object $other 375 375 */ 376 function merge_with( &$other ) {376 public function merge_with( &$other ) { 377 377 } 378 378 }
Note: See TracChangeset
for help on using the changeset viewer.