WP_Translation_File::translate()publicWP 6.5.0

Translates a given string.

Method of the class: WP_Translation_File{}

No Hooks.

Return

false|String. Translation(s) on success, false otherwise.

Usage

$WP_Translation_File = new WP_Translation_File();
$WP_Translation_File->translate( $text );
$text(string) (required)
String to translate.

Changelog

Since 6.5.0 Introduced.

WP_Translation_File::translate() code WP 6.7.1

public function translate( string $text ) {
	if ( ! $this->parsed ) {
		$this->parse_file();
	}

	return $this->entries[ $text ] ?? false;
}