Code snippet : WordPress qTranslate – Getting current language







So I was working with the qTranslate plugin of WordPress’s and needed to select an image depending on language. qTranslate provides a utility function which returns the current language.


The function is called qtrans_getLanguage() and it works as follows:


$currentLang = qtrans_getLanguage();
if($currentLang == 'fr')
{
//show french logo
$imageName = logoFR.png';
}
else if($currentLang == 'hi')
{
//show Hindi logo
$imageName = logoHI.png';
}
else
{
//show english logo to rest
$imageName = logoEN.png...
 •  0 comments  •  flag
Share on Twitter
Published on April 03, 2012 01:27
No comments have been added yet.