I think you are using a different language switcher. I've built mine from bits and pieces on the forum :)
This is in my page.php
<?php
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
);
/**
* Returns a DataObjectSet with all available translations of the current page
* @return DataObjectSet
*/
function getTranslationsFunc() {
if($this->URLSegment == "Security") return "";
$langs = Translatable::get_existing_content_languages();
$data = new DataObjectSet();
// generate entry with only the default language if no translations of this page are available
$availTransl = Translatable::getTranslations();
foreach(array_keys($langs) as $code) {
// get country code (e.g. "de")
$lang = i18n::get_lang_from_locale($code);
// current language?
$current = ($code == Translatable::get_current_locale()) ? 'current': 'normal';
$page = $this->getTranslation($code);
//echo $page;exit();
if(count($availTransl) == 0 && $current == "normal") {
$data->push(new ArrayData(array(
'name' => i18n::get_language_name($lang, true),
'link' => "/?locale=" . $code,
'urlSegment' => $page->URLSegment,
'code' => $code,
'shortCode' => substr($code, 0, 2),
'current' => $current
)));
} else {
$data->push(new ArrayData(array(
'name' => i18n::get_language_name($lang, true),
'link' => Director::baseURL() . $page->URLSegment,
'urlSegment' => $page->URLSegment,
'code' => $code,
'shortCode' => substr($code, 0, 2),
'current' => $current
)));
}
}
return $data;
}
}
class Page_Controller extends ContentController {
public function init() {
parent::init();
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
}
/**
* Returns a DataObjectSet with all available translations of the current page
* @return DataObjectSet
*/
function getTranslations() {
// call method of Page Object
return $this->getTranslationsFunc();
}
}
?>
and this is my language switcher in the template
<% if getTranslations %>
<ul class="language">
<% control getTranslations %>
<li class="$current"><a href="$link"><span>$shortCode</span></a></li>
<% end_control %>
</ul>
<% end_if %>