Translations::translate()publicWP 1.0

Method of the class: Translations{}

No Hooks.

Return

String.

Usage

$Translations = new Translations();
$Translations->translate( $singular, $context );
$singular(string) (required)
-
$context(string)
-
Default: null

Translations::translate() code WP 6.4.3

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;
}