Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 21 replies, has 6 voices.

Last updated by greenwizard 11 years, 4 months ago.

Author Posts
July 9, 2010 at 5:39 pm #18965

greenwizard

Hi i need to have the home button translated for 3 different languages, is it possible and how to do it ?
I also need to switch between 3 different jpg header logos for each language...?
I have checked some of the oldest post but i can`t find answers...if anyone has it fugured out please share 🙂

July 9, 2010 at 9:03 pm #18967

greenwizard

Hi again , i`ve been loking all day for a way to add proper home buttons in my menu and i finally did the trick with this plugin hidden link which adds an option for page to be used as a link...
, luckily my template has option in functions.php to hide the original home button 'menu.showHome' => false, , so my first issue is solved :)))))
I will be waiting for an answer on how to switch between 3 different jpg header logos for each language...?

July 10, 2010 at 6:21 pm #18968

Masino Sinaga

You can do some hard-code in your theme's header.php file. The most important thing that you have to do is you have to check which language code is currently active, and then put your image displaying code that related to the current language.
Please check this following article out:
<a href="hidden link">How to Get Current Language Code by Using WPML Plugin of WordPress</a>.
Demo: <a href="hidden link">Indonesia Regions</a>.
Hope it helps you.

July 12, 2010 at 12:12 pm #18969

greenwizard

yep i would like to hard-code the header the same as you did but i do not know how ...
may be if u post the code u have used in ur header then i will manage to do it 🙂
thanks for the quick response

July 12, 2010 at 12:43 pm #18970

Masino Sinaga

Basically, the code is something like the following:
Assuming:
- The languages for your site are: English, Spanish, and Germany.
- $logo is a variable that hold your logo's display.
if (ICL_LANGUAGE_CODE == 'en') { // English
$logo='<img src="images/LogoForEnglish.jpg">';
} else if (ICL_LANGUAGE_CODE == 'es') { // Spanish
$logo='<img src="images/LogoForSpanish.jpg">';
} else if (ICL_LANGUAGE_CODE == 'de') { // Germany
$logo='<img src="images/LogoForGermany.jpg">';
}
echo $logo;
Actually, it depends on the theme you use, since each theme save and treat the logo's image differently (for example: image directory, which file you put that code - usually in header.php).

July 12, 2010 at 3:02 pm #18971

taml

I too am looking to do something similar with changing the header for each language.
I am however using flash files as my header that I want to change per language.
Masino - do you have any idea how I get round this one?
Many thanks
Toby

July 12, 2010 at 3:36 pm #18972

greenwizard

I tried it like this
if (ICL_LANGUAGE_CODE == 'bg') { // Bulgarian
$logo='<img src="images/LogoForBulgarian.jpg">';
} else if (ICL_LANGUAGE_CODE == 'en') { // English
$logo='<img src="images/LogoForEnglish.jpg">';
} else if (ICL_LANGUAGE_CODE == 'fr') { // French
$logo='<img src="images/LogoForFrench.jpg">';
}
echo $logo;
but i gives me an error on top of the blog...
any idea where should i put it exactly
in my header.php
hidden link
and 🙂 how should use the How to Get Current Language Code tutorial for?
damn all this stuff got me sweating :)))

July 13, 2010 at 10:02 pm #18973

bornemix

Why not simply do
<img src=" bloginfo("template_url") . __("URLs", "Logo for home", "images/LogoForBulgarian.jpg") ">
... and then manage the different logos in the string admin page?

July 14, 2010 at 3:44 pm #18974

taml

@bornemix - because that's jargon to me unfortunately!
I'm pretty new to this so i'm looking for a bit more handholding that that!!
What I reeeally need is someone to tell me exactly what to put where lol

July 15, 2010 at 7:39 pm #18975

hamedhemmati

you can do it in an easier way. Just encapsulate your flash embed in the if statement. Something like this.
<?php if (ICL_LANGUAGE_CODE=='en') { ?>
html flash embed
<?php } if(ICL_LANGUAGE_CODE=='your second language code') { ?>
the html flash embed for the second language
<?php } ?>
.
.
.
you can do that for as many languages as you have and it only runs the embed code for that language.

July 19, 2010 at 12:46 pm #18976

taml

Awesome! That works perfectly - thank you so much.

July 19, 2010 at 9:33 pm #18977

unknown_guy

I do it like this:

<img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo_<?php echo ICL_LANGUAGE_CODE; ?>.png" />

`
And then have logo_en.png, logo_ru.png in images directory. Same for flash.

July 21, 2010 at 3:59 am #18978

Masino Sinaga

Great solutions, everyone!

July 26, 2010 at 6:47 pm #18979

greenwizard

hi again guys, thanks for all the help but i still cant figure out how and where to put the codes, i am using 3 languages with 3 logos, LogoForBulgarian.jpg, LogoForEnglish.jpg LogoForFrench.jpg with lang codes bg [default], en and fr. Here is copy of my header hidden link and the address of th bloh hidden link .. thanks in advance

July 26, 2010 at 10:26 pm #18980

unknown_guy

The code you posted earlier works for me:
<pre>

<?php
if (ICL_LANGUAGE_CODE == 'bg') { // Bulgarian
$logo='<img src="images/LogoForBulgarian.jpg">';
} else if (ICL_LANGUAGE_CODE == 'en') { // English
$logo='<img src="images/LogoForEnglish.jpg">';
} else if (ICL_LANGUAGE_CODE == 'fr') { // French
$logo='<img src="images/LogoForFrench.jpg">';
}
echo $logo;
?>

</pre>

The topic ‘[Closed] home button in 3 languages ? different jpg header logos for each language?’ is closed to new replies.