WP_Translation_File_PHP::parse_file()

In this article

Parses the file.

Source

protected function parse_file() {
	$this->parsed = true;

	$result = include $this->file;
	if ( ! $result || ! is_array( $result ) ) {
		$this->error = 'Invalid data';
		return;
	}

	if ( isset( $result['messages'] ) && is_array( $result['messages'] ) ) {
		foreach ( $result['messages'] as $original => $translation ) {
			$this->entries[ (string) $original ] = $translation;
		}
		unset( $result['messages'] );
	}

	$this->headers = array_change_key_case( $result );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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