Hi everyone!

I'm trying to add the localizer language switch directly to $primary_link variable.
Something like this:

$languages=localizer_block_switch_language_links(variable_get('localizer_switchblock_showflags', TRUE), variable_get('localizer_switchblock_showlangname',TRUE), variable_get('localizer_switchblock_flagseparator', ' ', FALSE));

foreach($languages as $i=>$link) {
echo $link;
}

$primary_links = $primary_links + array('traslation'=> Array('title'=>$language, 'href' => $link));

Of course this don't work...

The problem is that i can't extract url switcher from $link...

There is a localizer variable that contain the switcher url?

Comments

Giolf’s picture

Ok, I read localizer documentation and then solved in this way.

		if ($language == "it") {
                $switch_lang = "en";
                $lang_title = "English";
                $trans_link = "trans-link-en";
		  } else {
			$switch_lang = "it";
			$lang_title = "Italiano";
			$trans_link = "trans-link-it";
		  }
		
		$nodo = substr($_REQUEST['q'],3);
		
		$switch_url = localizernode_get_localized_path($nodo, $switch_lang);

		$primary_links = $primary_links + array($trans_link => array("title" => $lang_title, "href" => $switch_url));
		
		print theme('links', $primary_links, array('class' => '')) 

Now it works, but localizer automatically add current language before $switch_url (that containt the right url to the current node translation)...How to disable this?

coworksbe’s picture

Disabling prefixes can be done in admin/settings/localizer - collapsible "language prefixes".