function locale_translation_status_form_submit

Form submission handler for locale_translation_status_form().

File

drupal/core/modules/locale/locale.pages.inc, line 613
Interface translation summary, editing and deletion user interfaces.

Code

function locale_translation_status_form_submit($form, &$form_state) {
  module_load_include('fetch.inc', 'locale');
  $langcodes = array_filter($form_state['values']['langcodes']);

  // Set the translation import options. This determines if existing
  // translations will be overwritten by imported strings.
  $options = _locale_translation_default_update_options();

  // If the status was updated recently we can immediately start fetching the
  // translation updates. If the status is expired we clear it an run a batch to
  // update the status and then fetch the translation updates.
  $last_checked = Drupal::state()
    ->get('locale.translation_last_checked');
  if ($last_checked < REQUEST_TIME - LOCALE_TRANSLATION_STATUS_TTL) {
    locale_translation_clear_status();
    $batch = locale_translation_batch_update_build(array(), $langcodes, $options);
    batch_set($batch);
  }
  else {
    $batch = locale_translation_batch_fetch_build(array(), $langcodes, $options);
    batch_set($batch);
  }
}