You are here

function l10n_update_languages_changed_submit in Localization update 7.2

Same name and namespace in other branches
  1. 6 l10n_update.module \l10n_update_languages_changed_submit()
  2. 7 l10n_update.module \l10n_update_languages_changed_submit()

Additional submit handler for language forms.

We need to refresh status when a new language is enabled / disabled.

1 string reference to 'l10n_update_languages_changed_submit'
l10n_update_form_alter in ./l10n_update.module
Implements hook_form_alter().

File

./l10n_update.module, line 373
Download translations from remote localization server.

Code

function l10n_update_languages_changed_submit($form, $form_state) {
  if (variable_get('l10n_update_import_enabled', TRUE)) {
    if (empty($form_state['values']['predefined_langcode']) || $form_state['values']['predefined_langcode'] == 'custom') {
      $langcode = $form_state['values']['langcode'];
    }
    else {
      $langcode = $form_state['values']['predefined_langcode'];
    }

    // Download and import translations for the newly added language.
    module_load_include('fetch.inc', 'l10n_update');
    $options = _l10n_update_default_update_options();
    $batch = l10n_update_batch_update_build(array(), array(
      $langcode,
    ), $options);
    batch_set($batch);
  }
}