WP_Translation_File::get_plural_expression_from_header
Returns the plural forms expression as a tuple.
Method of the class: WP_Translation_File{}
No Hooks.
Returns
String. Plural forms expression.
Usage
// protected - for code of main (parent) or child class $result = $this->get_plural_expression_from_header( $header ): string;
- $header(string) (required)
- Plural-Forms header string.
Changelog
| Since 6.5.0 | Introduced. |
WP_Translation_File::get_plural_expression_from_header() WP Translation File::get plural expression from header code WP 6.9
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';
}