Use __($str) and _e($str) to translate strings with HTML

The sweet and short of it all is, never try to translate HTML tags. Use placeholders and either printf or sprintf to translate strings with HTML tags

Something like this will do

printf()

printf( __( 'This %s text %s have an %s HTML %s tag. Another sentence...' ), '<em>', '</em>', '<b>', '</b>' );

sprintf()

sprintf( __( 'This %s text %s have an %s HTML %s tag. Another sentence...' ), '<em>', '</em>', '<b>', '</b>' );

Leave a Comment