Title: Gettext_Translations::make_headers
Published: April 25, 2014
Last modified: May 20, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#wp--skip-link--target)

Prepare translation headers.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#parameters)󠁿

 `$translation`stringrequired

## 󠀁[Return](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#return)󠁿

 array<string, string> Translation headers

## 󠀁[Source](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/pomo/translations.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/pomo/translations.php#L377)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/pomo/translations.php#L377-L390)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/gettext_translations/make_headers/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fgettext_translations%2Fmake_headers%2F)
before being able to contribute a note or feedback.