wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_get_l10n_php_file_data › WordPress Function

Since6.6.0
Deprecatedn/a
wp_get_l10n_php_file_data ( $php_file )
Parameters:
  • (string) $php_file Path to a `.l10n.php` file.
    Required: Yes
Returns:
  • (string[]) Array of file header values keyed by header name.
Defined at:
Codex:

Extracts headers from a PHP translation file.



Source

function wp_get_l10n_php_file_data( $php_file ) {
	$data = (array) include $php_file;

	unset( $data['messages'] );
	$headers = array(
		'POT-Creation-Date'  => 'pot-creation-date',
		'PO-Revision-Date'   => 'po-revision-date',
		'Project-Id-Version' => 'project-id-version',
		'X-Generator'        => 'x-generator',
	);

	$result = array(
		'POT-Creation-Date'  => '',
		'PO-Revision-Date'   => '',
		'Project-Id-Version' => '',
		'X-Generator'        => '',
	);

	foreach ( $headers as $po_header => $php_header ) {
		if ( isset( $data[ $php_header ] ) ) {
			$result[ $po_header ] = $data[ $php_header ];
		}
	}

	return $result;
}