I want to put this type of logic in the code of a link for language switching in a multilingual site :
=========================================
If ($CurrentLanguage == "English")
{
switch to French menu, French theme and French content;
switch the switching link to "English";
}
Else if ($CurrentLanguage == "French")
{
switch to English menu, English theme and English content;
switch the switching link to "French";
}
End if
=========================================
When the user clicks on the switching link somewhere on the site (for example in the navigation bar of the header of a custom theme), the above code and logic are executed. I would like to put this code in the page.tpl.php of the custom theme.
I am using the localizer module. The localizer module has a nice switching block for executing this code, but I want to take this code out of the block and put it in a link in the page.tpl.php instead.
Any ideas on how to code this ?
What is the global variable for checking the current language ?
Any suggestions are appreciated. Thanks.
Comments
Different Block for each menu
You could have two separate menus for each locale. Use the Localizer block module to set the menu block to the proper locale.
I have created a menu for
I have created a menu for each locale, one English menu and one French menu. There is no problem at all in using the localizer block (included in the module) to switch the menu block.
My original question is how to do the same thing ON A LINK ?! Clicking on the link would switch the locale.
How to put the same logic and code of the localizer block in a PHP code for a LINK that I can put anywhere on my site ?
Susggestions anyone ?
I have the same problem
It must be really simple... So how to switch a locale? Function call? Variable?
similar problem for me..
..the localizer.block somehow does not do its job - so both of my navi-menues (german/english) are shown..
Now I'd like to fix that and some other issues (different logo-picture for each language etc) through a language-variable - something like
if($language == "English") {
echo("this is english");
return(TRUE);
} else {
echo("this is NOT english");
return(FALSE);
}
..would be phantastic - but I just cant find the appropriate variable that contains the current language.. - ..help..?
thanx! greetz, till..
___________________________
I posted the question over
I posted the question over at the translation-forum - and got the answer to the problem from pobster:
..so for my/our little problem the thing would be something like this:
..works with localizer module on, but probably also only with the locale module..
greetz, till..
___________________________
my pictures: www.bilderbook.org
___________________________
I'm using
I'm using this:
_________________________________
mine of creativity
I tried to cpy this into my
I tried to cpy this into my blog and now my whole page is screwed up....
I get this error
Fatal error: Call to undefined function localizer_block_switchuilocale_links() in /home/riccardo/domains/alizee-fanpage.com/includes/common.inc(1450) : eval()'d code on line 2
Check out my blog
http://blog.riccardo-ulpts.com
I'm using
Duplicated, my internet network did this :P
_________________________________
mine of creativity
link to switch languages
Thus I'd like to use an image as a link for the language switcher, I wanted to ask, how to generate a link to switch from one language to another... so, that the path of the link alternates corresponding to the current language. I was looking through the localizer.module and functions like localizer_switchuilocale($_locale) or localizer_set_uilocale($_locale = '') are sounding quite promising, but apparently and unfortunaltely it doesn't work that easy. Maybe I'm doing sth wrong, thus my php-knowledge is limited, but does anybody has a clue, what I'm doing wrong? Help would be very much appreciated thus I don't know, what else to try...
Thanks very much!
link to switch languages
oh ... duplicated post
It might help...
If you are using i18n module, then it will help...
$current_lang = i18n_get_lang();