Conditional Shortcode Based on Language

Things like emails sent to users by different plugins can not be translated because they do not appear in the front-end.

For these other types of content you can display content based on language using the shortcode:

[trp_language language="en_US"] English content only [/trp_language]

An important use case of the conditional shortcode is for translating images, basically displaying different images for different languages.

[trp_language language="en_US"] 
<img src="https://example.com/image_en.png" /> [/trp_language]
[trp_language language="fr_FR"]
<img src="https://example.com/image_fr.png" />
[/trp_language]

This can be done also with PHP:

<?php 

$current_language = get_locale();

if( $current_language == 'en_EN' ){
echo 'text in language en_EN';
}
if( $current_language == 'fr_FR' ){
echo 'text in language fr_FR';
}

?>