Title: WP_Translation_File_PHP::export
Published: April 3, 2024
Last modified: May 20, 2026

---

# WP_Translation_File_PHP::export(): string

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_translation_file_php/export/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_translation_file_php/export/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_translation_file_php/export/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_translation_file_php/export/?output_format=md#changelog)

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

Exports translation contents as a string.

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

 string Translation file contents.

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

    ```php
    public function export(): string {
    	$data = array_merge( $this->headers, array( 'messages' => $this->entries ) );

    	return '<?php' . PHP_EOL . 'return ' . $this->var_export( $data ) . ';' . PHP_EOL;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n/class-wp-translation-file-php.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/l10n/class-wp-translation-file-php.php#L47)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/l10n/class-wp-translation-file-php.php#L47-L51)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_translation_file_php/export/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Translation_File_PHP::var_export()](https://developer.wordpress.org/reference/classes/wp_translation_file_php/var_export/)`wp-includes/l10n/class-wp-translation-file-php.php` |

Outputs or returns a parsable string representation of a variable.

  |

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

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

## User Contributed Notes

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