You are here

function _locale_admin_manage_screen_submit in Drupal 5

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

Process locale admin manager form submissions.

File

includes/locale.inc, line 113
Admin-related functions for locale.module.

Code

function _locale_admin_manage_screen_submit($form_id, $form_values) {

  // Save changes to existing languages.
  $languages = locale_supported_languages(FALSE, TRUE);
  foreach ($languages['name'] as $key => $value) {
    if ($form_values['site_default'] == $key) {
      $form_values['enabled'][$key] = 1;

      // autoenable the default language
    }
    $enabled = $form_values['enabled'][$key] ? 1 : 0;
    if ($key == 'en') {

      // Disallow name change for English locale.
      db_query("UPDATE {locales_meta} SET isdefault = %d, enabled = %d WHERE locale = 'en'", $form_values['site_default'] == $key, $enabled);
    }
    else {
      db_query("UPDATE {locales_meta} SET name = '%s', isdefault = %d, enabled = %d WHERE locale = '%s'", $form_values['name'][$key], $form_values['site_default'] == $key, $enabled, $key);
    }
  }
  drupal_set_message(t('Configuration saved.'));

  // Changing the locale settings impacts the interface:
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  return 'admin/settings/locale/language/overview';
}