locale_admin_manage_delete_screen

Versions
4.6
locale_admin_manage_delete_screen()

User interface for the language deletion confirmation screen

Code

modules/locale.module, line 291

<?php
function locale_admin_manage_delete_screen() {
  include_once 'includes/locale.inc';
  $langcode = arg(4);
  $edit = $_POST['edit'];

  // Check confirmation and if so, delete language
  if ($edit['confirm']) {
    $languages = locale_supported_languages(FALSE, TRUE);
    if (isset($languages['name'][$edit['langcode']])) {
      db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $edit['langcode']);
      db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $edit['langcode']);
      $message = t('%locale language removed.', array('%locale' => theme('placeholder', t($languages['name'][$edit['langcode']]))));
      drupal_set_message($message);
      watchdog('locale', $message);
    }

    // Changing the locale settings impacts the interface:
    cache_clear_all();
    drupal_goto('admin/locale/language/overview');
  }

  // Do not allow deletion of English locale
  if ($langcode == 'en') {
    drupal_goto('admin/locale/language/overview');
    return;
  }

  // For other locales, warn user that data loss is ahead
  $languages = locale_supported_languages(FALSE, TRUE);

  $extra = form_hidden('langcode', $langcode);
  $output = theme('confirm',
                  t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))),
                  'admin/locale/language/overview',
                  t('Deleting a language will remove all data associated with it. This action cannot be undone.'),
                  t('Delete'),
                  t('Cancel'),
                  $extra);
  print theme('page', $output);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.