Gettext_Translations::nplurals_and_expression_from_header() WordPress Method

This method parses the header of a PO file and extracts the nplurals and plural forms expressions if present.

Gettext_Translations::nplurals_and_expression_from_header( string $header ) #


Parameters

$header

(string)(Required)


Top ↑

Return

(array)


Top ↑

Source

File: wp-includes/pomo/translations.php

		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' );
			}
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.