Translations::translate( string $singular, string $context = null ): string

In this article

Translates a singular string.

Parameters

$singularstringrequired
$contextstringoptional

Default:null

Return

string

Source

public function translate( $singular, $context = null ) {
	$entry      = new Translation_Entry(
		array(
			'singular' => $singular,
			'context'  => $context,
		)
	);
	$translated = $this->translate_entry( $entry );
	return ( $translated && ! empty( $translated->translations ) ) ? $translated->translations[0] : $singular;
}

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

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