Using _e() or __() to translate text with div

Question

Is this the correct way to translate a sting of text?

_e( '<h2 class="title">' . $var . '</h2>', 'text-domain' );

or, is this?

echo '<h2 class="title">';
_e( $var, 'text-domain' );
echo '</h2>';

or this?

printf( __( '<h2 class="title">%s</h2>', 'text-domain' ), $var );
0
Dev 4 months 0 Answers 16 views 0

Leave an answer