Gettext_Translations::nplurals_and_expression_from_header()publicWP 2.8.0

Returns the nplurals and plural forms expression from the Plural-Forms header.

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

Хуков нет.

Возвращает

Массив{0:. int, 1: string}

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

$Gettext_Translations = new Gettext_Translations();
$Gettext_Translations->nplurals_and_expression_from_header( $header );
$header(строка) (обязательный)
-

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

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

Код Gettext_Translations::nplurals_and_expression_from_header() WP 6.5.2

public function nplurals_and_expression_from_header( $header ) {
	if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {
		$nplurals   = (int) $matches[1];
		$expression = trim( $matches[2] );
		return array( $nplurals, $expression );
	} else {
		return array( 2, 'n != 1' );
	}
}