dio5, I've only downloaded the language chooser widget and then I've only made a /db/build.
I have this code in my "languagechooser.php" (this file is part of languagechooser widget):
class LanguageChooser extends Widget {
static $title = "Language Chooser";
static $cmsTitle = "Language Chooser";
static $description = "Allows you to choose your language";
static $db = array("ShowCurrent" => "Boolean");
static $defaults = array('ShowCurrent' => false);
function getCMSFields(){
return new FieldSet(new CheckboxField('ShowCurrent', _t('LanguageChooser.SHOWCURRENT', 'Show current language')));
}
function Chooser() {
if(!isset(Controller::currentController()->ID)) {
return; // So it doesn't break on Controller-less pages
}
$langs = i18n::get_existing_content_languages();
$data = new DataObjectSet();
foreach(array_keys($langs) as $code) {
if($code == Translatable::current_lang() && !$this->ShowCurrent) {
continue;
}
$page = Translatable::get_one_by_lang("SiteTree", $code, "`SiteTree`.ID = " . Controller::currentController()->ID);
if(!$page) {
$data->push(new ArrayData(array('name' => i18n::get_language_name($code, true), 'link' => Director::protocolAndHost() . Director::baseURL() . '?lang=' . $code)));
} else {
$data->push(new ArrayData(array('name' => i18n::get_language_name($code, true), 'link' => Director::protocolAndHost() . Director::baseURL() . $page->URLSegment . '?lang=' . $code)));
}
}
return $data;
}
function WidgetHolder() {
if(count(i18n::get_existing_content_languages()) > 1) {
return $this->renderWith("WidgetHolder");
}
return "";
}
}
I hope this code help you.
I'm not sure if this is what you want, but it's what I'm using.
Best Regards