I am conditionally concatenating a very long string onto another very long string. Then I am returning it as the argument to another function. I think I should translate the strings individually first, and then concatenate the result. However, I know in general strings should be concatenated first, and then translated, as this will make a better translation. But the conditional prevents that, and maybe it doesn't matter anyway if both strings are 3+ sentences long. Also I would normally use sprintf
with the second string represented as a placeholder, but it's too long for that.
function get_string(){
$str = __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla lacinia sagittis
elit, ut vehicula sapien pulvinar id. Phasellus blandit non sapien non efficitur. Etiam
lacinia mi ac aliquam lacinia. Pellentesque blandit, lectus sit amet ultricies consequat,
enim augue fermentum massa, sed tempor elit arcu nec turpis.', 'text-domain' );
if ( is_page_template( 'page_templates/abcd' ){
$str .= __('Nam mattis bibendum mauris nec commodo. Nunc posuere, ex sed auctor ornare, odio
urna accumsan nisi, ac luctus arcu nisl lobortis mauris. Etiam volutpat sagittis felis,vitae
efficitur elit vehicula id. Vivamus faucibus risus risus, quis pretium nibh semper vitae.
Sed vehicula ex velit, auctor hendrerit risus bibendum eget. Nulla sit amet efficitur ex.','text- domain');
}
return $str;
}
Is this correct?