Gettext_Translations::make_headers() WordPress Method

The Gettext_Translations::make_headers() method can be used to create a translation file for a WordPress plugin or theme. This translation file can be used to translate the plugin or theme into another language.

Gettext_Translations::make_headers( string $translation ) #


Parameters

$translation

(string)(Required)


Top ↑

Return

(array)


Top ↑

Source

File: wp-includes/pomo/translations.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;
		}

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.