original_string: public function switchLocale($locale = null)
      {
          if (null === $locale) {
              $locale = $this->getLocale();
          } elseif ($this->getLocale() != $locale) {
              $this->setLocale($locale);
          }
  
          $this->locale->setLocale($locale);
          $this->translateAdapter->setLocale($locale);
  
          return \Gems_Cookies::setLocale($locale, $this->basepath->getBasePath());
      }
code: public function switchLocale($locale = null)
      {
          if (null === $locale) {
              $locale = $this->getLocale();
          } elseif ($this->getLocale() != $locale) {
              $this->setLocale($locale);
          }
  
          $this->locale->setLocale($locale);
          $this->translateAdapter->setLocale($locale);
  
          return \Gems_Cookies::setLocale($locale, $this->basepath->getBasePath());
      }
code_tokens: public function switchLocale ( $ locale = null ) { if ( null === $ locale ) { $ locale = $ this -> getLocale ( ) ; } elseif ( $ this -> getLocale ( ) != $ locale ) { $ this -> setLocale ( $ locale ) ; } $ this -> locale -> setLocale ( $ locale ) ; $ this -> translateAdapter -> setLocale ( $ locale ) ; return \ Gems_Cookies :: setLocale ( $ locale , $ this -> basepath -> getBasePath ( ) ) ; }
docstring: Switch to new locale
  
  @param string $locale Current if omitted
  @return boolean true if cookie was set
docstring_tokens: Switch to new locale