You are here

function l10n_update_language_refresh in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.check.inc \l10n_update_language_refresh()

Language refresh. Runs a batch for loading the selected languages.

To be used after adding a new language.

Parameters

$languages: Array of language codes to check and download.

1 call to l10n_update_language_refresh()
l10n_update_languages_changed_submit in ./l10n_update.module
Aditional submit handler for language forms

File

./l10n_update.check.inc, line 480
Reusable API for l10n remote updates using $source objects

Code

function l10n_update_language_refresh($languages) {
  $projects = l10n_update_get_projects();
  if ($available = l10n_update_check_projects($projects, $languages)) {
    $history = l10n_update_get_history();
    if ($updates = l10n_update_build_updates($history, $available)) {
      module_load_include('batch.inc', 'l10n_update');

      // Filter out updates in other languages. If no languages, all of them will be updated
      $updates = _l10n_update_prepare_updates($updates);
      $batch = l10n_update_batch_multiple($updates, variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP));
      batch_set($batch);
    }
  }
}