PO::add_comment_to_entry()publicWP 1.0

Method of the class: PO{}

No Hooks.

Return

null. Nothing (null).

Usage

$PO = new PO();
$PO->add_comment_to_entry( $entry, $po_comment_line );
$entry(Translation_Entry) (required) (passed by reference — &)
-
$po_comment_line(string) (required)
-

PO::add_comment_to_entry() code WP 6.5.2

public function add_comment_to_entry( &$entry, $po_comment_line ) {
	$first_two = substr( $po_comment_line, 0, 2 );
	$comment   = trim( substr( $po_comment_line, 2 ) );
	if ( '#:' === $first_two ) {
		$entry->references = array_merge( $entry->references, preg_split( '/\s+/', $comment ) );
	} elseif ( '#.' === $first_two ) {
		$entry->extracted_comments = trim( $entry->extracted_comments . "\n" . $comment );
	} elseif ( '#,' === $first_two ) {
		$entry->flags = array_merge( $entry->flags, preg_split( '/,\s*/', $comment ) );
	} else {
		$entry->translator_comments = trim( $entry->translator_comments . "\n" . $comment );
	}
}