You are here

function locale_languages_predefined_form_submit in Drupal 6

Same name and namespace in other branches
  1. 7 modules/locale/locale.admin.inc \locale_languages_predefined_form_submit()

Process the language addition form submission.

Related topics

1 string reference to 'locale_languages_predefined_form_submit'
locale_languages_custom_form in includes/locale.inc
Custom language addition form.

File

includes/locale.inc, line 312
Administration functions for locale.module.

Code

function locale_languages_predefined_form_submit($form, &$form_state) {
  $langcode = $form_state['values']['langcode'];
  if (isset($form_state['values']['name'])) {

    // Custom language form.
    locale_add_language($langcode, $form_state['values']['name'], $form_state['values']['native'], $form_state['values']['direction'], $form_state['values']['domain'], $form_state['values']['prefix']);
    drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array(
      '%language' => t($form_state['values']['name']),
      '@locale-help' => url('admin/help/locale'),
    )));
  }
  else {

    // Predefined language selection.
    $predefined = _locale_get_predefined_list();
    locale_add_language($langcode);
    drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array(
      '%language' => t($predefined[$langcode][0]),
      '@locale-help' => url('admin/help/locale'),
    )));
  }

  // See if we have language files to import for the newly added
  // language, collect and import them.
  if ($batch = locale_batch_by_language($langcode, '_locale_batch_language_finished')) {
    batch_set($batch);
  }
  $form_state['redirect'] = 'admin/settings/language';
  return;
}