/**
  * Return a link to the homepage for the current locale
  *
  * @return string link to the homepage for the current locale
  */
 public function BaseLinkForLocale()
 {
     $prefix = LanguagePrefix::get_prefix($this->owner->Locale);
     $prefixLink = $prefix ? $prefix . '/' : '';
     return Controller::join_links(Director::baseURL(), $prefixLink);
 }
 /**
  * Return a link to the homepage for the current locale
  * 
  * @return string link to the homepage for the current locale 
  */
 public function BaseLinkForLocale()
 {
     return Controller::join_links(Director::baseURL(), LanguagePrefix::get_prefix($this->owner->Locale), '/');
 }
 /**
  * Distill the locale from the URL's language prefix. If the prefix isn't a
  * proper locale, return false
  *
  * @return boolean valid locale found
  */
 protected function setLocale($prefix)
 {
     if ($locale = LanguagePrefix::get_locale_from_prefix($prefix)) {
         $this->locale = $locale;
         Translatable::set_current_locale($this->locale);
         return true;
     } else {
         return false;
     }
 }
 function testRootUrlDefaultsToTranslatedLink()
 {
     $origPage = $this->objFromFixture('Page', 'homepage_en');
     $origPage->publish('Stage', 'Live');
     $translationDe = $origPage->createTranslation('de_DE');
     $translationDe->URLSegment = 'heim';
     $translationDe->write();
     $translationDe->publish('Stage', 'Live');
     // test with translatable
     Translatable::set_current_locale('de_DE');
     $this->assertEquals(LanguagePrefix::get_homepage_link_by_locale('de_DE'), 'heim', 'Homepage with different URLSegment in non-default language is found');
     // @todo Fix add/remove extension
     // test with translatable disabled
     // Object::remove_extension('Page', 'Translatable');
     // 		$_SERVER['HTTP_HOST'] = '/';
     // 		$this->assertEquals(
     // 			RootURLController::get_homepage_urlsegment(),
     // 			'home',
     // 			'Homepage is showing in default language if ?lang GET variable is left out'
     // 		);
     // 		Object::add_extension('Page', 'Translatable');
     // setting back to default
     Translatable::set_current_locale('en_US');
 }