WP_Translations::make_entry( string $original, string $translations ): Translation_Entry

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use MO::make_entry() instead.

Builds a Translation_Entry from original string and translation strings.

Description

See also

Parameters

$originalstringrequired
Original string to translate from MO file. Might contain 0x04 as context separator or 0x00 as singular/plural separator.
$translationsstringrequired
Translation strings from MO file.

Return

Translation_Entry Entry instance.

Source

private function make_entry( $original, $translations ): Translation_Entry {
	$entry = new Translation_Entry();

	// Look for context, separated by \4.
	$parts = explode( "\4", $original );
	if ( isset( $parts[1] ) ) {
		$original       = $parts[1];
		$entry->context = $parts[0];
	}

	$entry->singular     = $original;
	$entry->translations = explode( "\0", $translations );
	$entry->is_plural    = count( $entry->translations ) > 1;

	return $entry;
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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