original_string: public function setDefault($id)
      {
          $this->loadModel('Locale.Languages');
          $this->loadModel('System.Options');
          $language = $this->Languages->get($id);
  
          if ($language->status) {
              if ($this->Options->update('default_language', $language->code)) {
                  $this->Flash->success(__d('locale', 'Default language changed!'));
              } else {
                  $this->Flash->danger(__d('locale', 'Default language could not be changed.'));
              }
          } else {
              $this->Flash->danger(__d('locale', 'You cannot set as default a disabled language.'));
          }
  
          $this->title(__d('locale', 'Set Default Language'));
          $this->redirect($this->referer());
      }
code: public function setDefault($id)
      {
          $this->loadModel('Locale.Languages');
          $this->loadModel('System.Options');
          $language = $this->Languages->get($id);
  
          if ($language->status) {
              if ($this->Options->update('default_language', $language->code)) {
                  $this->Flash->success(__d('locale', 'Default language changed!'));
              } else {
                  $this->Flash->danger(__d('locale', 'Default language could not be changed.'));
              }
          } else {
              $this->Flash->danger(__d('locale', 'You cannot set as default a disabled language.'));
          }
  
          $this->title(__d('locale', 'Set Default Language'));
          $this->redirect($this->referer());
      }
code_tokens: public function setDefault ( $ id ) { $ this -> loadModel ( 'Locale.Languages' ) ; $ this -> loadModel ( 'System.Options' ) ; $ language = $ this -> Languages -> get ( $ id ) ; if ( $ language -> status ) { if ( $ this -> Options -> update ( 'default_language' , $ language -> code ) ) { $ this -> Flash -> success ( __d ( 'locale' , 'Default language changed!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'locale' , 'Default language could not be changed.' ) ) ; } } else { $ this -> Flash -> danger ( __d ( 'locale' , 'You cannot set as default a disabled language.' ) ) ; } $ this -> title ( __d ( 'locale' , 'Set Default Language' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
docstring: Sets the given language as site's default language.
  
  @param int $id Language's ID
  @return void Redirects to previous page
docstring_tokens: Sets the given language as site s default language .