Gettext_Translations::make_plural_form_function()publicWP 2.8.0

Makes a function, which will return the right translation index, according to the plural forms header.

Метод класса: Gettext_Translations{}

Хуков нет.

Возвращает

callable.

Использование

$Gettext_Translations = new Gettext_Translations();
$Gettext_Translations->make_plural_form_function( $nplurals, $expression );
$nplurals(int) (обязательный)
-
$expression(строка) (обязательный)
-

Список изменений

С версии 2.8.0 Введена.

Код Gettext_Translations::make_plural_form_function() WP 6.5.2

public function make_plural_form_function( $nplurals, $expression ) {
	try {
		$handler = new Plural_Forms( rtrim( $expression, ';' ) );
		return array( $handler, 'get' );
	} catch ( Exception $e ) {
		// Fall back to default plural-form function.
		return $this->make_plural_form_function( 2, 'n != 1' );
	}
}