Change header when select another language

Change header when select another language

by chihuei lu -
Number of replies: 7
Hi,
I am working on a website with two languages. Is there any way to change the header of website when users select another language? (I am running Moodle 1.9). Thanks!!
Average of ratings: -
In reply to chihuei lu

Re: Change header when select another language

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Have you looked at the multi-lang filter? http://docs.moodle.org/en/Multi_lang

Jon
In reply to Jon Witts

Re: Change header when select another language

by chihuei lu -
My header is an image. span lang does not work.
In reply to chihuei lu

Re: Change header when select another language

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You would need to construct an if else statement in your header.php file that checked which language string was chosen and echoed the appropriate image tag out... Should not be too hard to achieve.
In reply to Jon Witts

Re: Change header when select another language

by chihuei lu -
Thank you for your reply. I'd appreciate any information you could give me because I know nothing about php. (should this be header.html?) Now I got everything working on multi-language on my Moodle site except header and footer. I put
<td width="690" align="left"><span lang="en" class="multilang" ><p class="footer_content">content.....</p></span><span lang="id" class="multilang" ><p class="footer_content">content.....</p></span> on footer to display either Indonesian or English based on what language that users have selected, but both languages are shown. I guess language filters do work on header and footer. Is that right? Thanks.
In reply to chihuei lu

Re: Change header when select another language

by chihuei lu -
I wrote this code. It does not work.sad
<?php
if (empty($USER->lang)) {
// user is guest or anonymous
$lang = optional_param("lang", "en_utf8");
} else {
$lang = $USER->lang;
}

switch ($lang) {
case 'en_utf8': do_sth '<img src="'.$CFG->themewww.'/'.current_theme().'/pix/fire_logo.png" width="950" height="88" alt="home" title="home">'); break;
case 'es_utf8': do_sth '<img src="'.$CFG->themewww.'/'.current_theme().'/pix/fire_header_id.png" width="950" height="88" alt="home" title="home">'); break;
}
?>
In reply to chihuei lu

Re: Change header when select another language

by Robert Brenstein -
In reply to Robert Brenstein

Re: Change header when select another language

by chihuei lu -
I do this and it works!
<?php
$lang = current_language();
if (empty($lang)) {
$lang = optional_param("lang", "en_utf8");
}

switch ($lang) {
case 'en_utf8': echo '<img src="../theme/CRK/pix/fire_logo.png" width="950" height="88" alt="home" title="home">'; break;
case 'id_utf8': echo '<img src="../theme/CRK/pix/fire_header_id.png" width="950" height="88" alt="home" title="home">'; break;
}

?>

Now my another task is how to change topic section when users change their language preference. I embed an iframe in the topic section, but I don't know how to change it when language switch.