Gettext_Translations::make_headers( string $translation ): array<string,

In this article

Prepare translation headers.

Parameters

$translationstringrequired

Return

array<string, string> Translation headers

Source

public function make_headers( $translation ) {
	$headers = array();
	// Sometimes \n's are used instead of real new lines.
	$translation = str_replace( '\n', "\n", $translation );
	$lines       = explode( "\n", $translation );
	foreach ( $lines as $line ) {
		$parts = explode( ':', $line, 2 );
		if ( ! isset( $parts[1] ) ) {
			continue;
		}
		$headers[ trim( $parts[0] ) ] = trim( $parts[1] );
	}
	return $headers;
}

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

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