Translations::translate_plural( string $singular, string $plural, int $count, string $context = null )


Parameters Parameters

$singular

(string) (Required)

$plural

(string) (Required)

$count

(int) (Required)

$context

(string) (Optional)

Default value: null


Top ↑

Source Source

File: wp-includes/pomo/translations.php

		function translate_plural( $singular, $plural, $count, $context = null ) {
			$entry              = new Translation_Entry(
				array(
					'singular' => $singular,
					'plural'   => $plural,
					'context'  => $context,
				)
			);
			$translated         = $this->translate_entry( $entry );
			$index              = $this->select_plural_form( $count );
			$total_plural_forms = $this->get_plural_forms_count();
			if ( $translated && 0 <= $index && $index < $total_plural_forms &&
				is_array( $translated->translations ) &&
				isset( $translated->translations[ $index ] ) ) {
				return $translated->translations[ $index ];
			} else {
				return 1 == $count ? $singular : $plural;
			}
		}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.