WP_Translation_File::get_plural_expression_from_header( string $header ): string

In this article

Returns the plural forms expression as a tuple.

Parameters

$headerstringrequired
Plural-Forms header string.

Return

string Plural forms expression.

Source

protected function get_plural_expression_from_header( string $header ): string {
	if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {
		return trim( $matches[2] );
	}

	return 'n != 1';
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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