public function delete($id)
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->get($id);

        if (!in_array($language->code, [CORE_LOCALE, option('default_language')])) {
            if ($this->Languages->delete($language)) {
                $this->Flash->success(__d('locale', 'Language successfully removed!'));
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be removed, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot remove this language as it still in use.'));
        }

        $this->title(__d('locale', 'Delete Language'));
        $this->redirect($this->referer());
    }
public function delete($id)
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->get($id);

        if (!in_array($language->code, [CORE_LOCALE, option('default_language')])) {
            if ($this->Languages->delete($language)) {
                $this->Flash->success(__d('locale', 'Language successfully removed!'));
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be removed, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot remove this language as it still in use.'));
        }

        $this->title(__d('locale', 'Delete Language'));
        $this->redirect($this->referer());
    }
public function delete ( $ id ) { $ this -> loadModel ( 'Locale.Languages' ) ; $ language = $ this -> Languages -> get ( $ id ) ; if ( ! in_array ( $ language -> code , [ CORE_LOCALE , option ( 'default_language' ) ] ) ) { if ( $ this -> Languages -> delete ( $ language ) ) { $ this -> Flash -> success ( __d ( 'locale' , 'Language successfully removed!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'locale' , 'Language could not be removed, please try again.' ) ) ; } } else { $ this -> Flash -> danger ( __d ( 'locale' , 'You cannot remove this language as it still in use.' ) ) ; } $ this -> title ( __d ( 'locale' , 'Delete Language' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Unregisters the given language.

@param int $id Language's ID
@return void Redirects to previous page
Unregisters the given language .