how to detect the current language

Permalink
Hi,

I'm using Internationalization & trying to set up a global area for each language with an if else statement. I've tried this on my homepage, works fine & returns a different result for each language installed:

<?php $lh = Loader::helper('section', 'multilingual'); $lh->getLanguage();
$lh = Loader::helper('section', 'multilingual');

?>
<?php echo $lh->getLanguage(); ?>


HOWEVER, when I use the same code on another page (ie not my homepage) it won't work. Does anyone know why it will only work on my homepage & what I can do about it please?,

I've also tried this by Remo:

<?php
$lh = Loader::helper('section', 'multilingual');
$currentlang = $lh->getLanguage(); // de_DE, fr_FR, en_US, en_GB, Handling via Multilingual add-on...
$b = new GlobalArea('NameOfArea ' . $currentlang);
$b->display($c);
?>

again it won't work as it thinks all pages are GB. I've set it all up fine as far as I can tell - the file structure is:

C5home
lang1home
lang1about
lang2home
lang2 about
etc
etc
and the pages switch between languages as you'd expect so I really don't know why this won't work. Please can anyone help????

 
bek replied on at Permalink Reply
I've just a had a eureka moment - it didn't work because I didn't put it in the header or footer....