I am using i18n module for language translation.

I want to set only one flag in a language block. When user click on that flag, language needs to change accordingly.

For example right now flag is of english language and language is spanish. when i click on flag of english then language must be convert in english and now flag of spanish will display.

Anybody done anywhere like my requirement the please give some suggestion or tell me the way how u do that.

Thanking you in advance ! :)

Comments

pushkarpathak’s picture

One solution could be to use if statement:

if($language == "en"):
***************
endif;

if($language == "es"):
*****************************
endif;

Try this one.

Pushkar Pathak
www.excelsolutions.biz

gburnham’s picture

I'm looking to do something similar, zeal, (well, not similar, but I'm sure the answer to your question will answer mine).

chanakya, I thought that the $language variable was part of 6.x not 5.x - am I wrong?

I'd like a nice simple way to find out what the current language selection is - is that possible?

zeal’s picture

Hello gburnham ,

Yes, you can find current language using $locale variable which is global variable.

write: global $locale;
it will return you current language.

and if you are using i18n then there is function "i18n_get_lang();" It also return current language.

try this way: $current_lang = i18n_get_lang();
echo $current_lang;

Hope it may help you.

gburnham’s picture

Thanks zeal, that's exactly what I'm looking for. You rock!