You are here

function locale_languages_delete_form in Drupal 7

Same name and namespace in other branches
  1. 6 includes/locale.inc \locale_languages_delete_form()

User interface for the language deletion confirmation screen.

Related topics

1 string reference to 'locale_languages_delete_form'
locale_menu in modules/locale/locale.module
Implements hook_menu().

File

modules/locale/locale.admin.inc, line 432
Administration functions for locale.module.

Code

function locale_languages_delete_form($form, &$form_state, $langcode) {

  // Do not allow deletion of English locale.
  if ($langcode == 'en') {
    drupal_set_message(t('The English language cannot be deleted.'));
    drupal_goto('admin/config/regional/language');
  }
  if (language_default('language') == $langcode) {
    drupal_set_message(t('The default language cannot be deleted.'));
    drupal_goto('admin/config/regional/language');
  }

  // For other languages, warn user that data loss is ahead.
  $languages = language_list();
  if (!isset($languages[$langcode])) {
    drupal_not_found();
    drupal_exit();
  }
  else {
    $form['langcode'] = array(
      '#type' => 'value',
      '#value' => $langcode,
    );
    return confirm_form($form, t('Are you sure you want to delete the language %name?', array(
      '%name' => t($languages[$langcode]->name),
    )), 'admin/config/regional/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
  }
}