You are here

function l10n_update_batch_multiple in Localization update 6

Same name and namespace in other branches
  1. 7 l10n_update.batch.inc \l10n_update_batch_multiple()

Create a big batch for multiple projects and languages.

Parameters

$updates: Array of update sources to be run.

$mode: Import mode. How to treat existing and modified translations.

Return value

array

4 calls to l10n_update_batch_multiple()
drush_l10n_update in ./l10n_update.drush.inc
Callback for command l10n-update.
l10n_update_admin_import_form_submit in ./l10n_update.admin.inc
Submit handler for Update form.
l10n_update_language_refresh in ./l10n_update.check.inc
Language refresh. Runs a batch for loading the selected languages.
l10n_update_project_refresh in ./l10n_update.project.inc
Refresh projects after enabling/disabling modules

File

./l10n_update.batch.inc, line 57

Code

function l10n_update_batch_multiple($updates, $import_mode) {
  foreach ($updates as $update) {
    $id = $update->filename;
    if ($update->type == 'download') {
      $operations[] = array(
        '_l10n_update_batch_download',
        array(
          $id,
          $update,
        ),
      );
      $operations[] = array(
        '_l10n_update_batch_import',
        array(
          $id,
          NULL,
          $import_mode,
        ),
      );
    }
    else {
      $operations[] = array(
        '_l10n_update_batch_import',
        array(
          $id,
          $update,
          $import_mode,
        ),
      );
    }

    // This one takes always parameters from results.
    $operations[] = array(
      '_l10n_update_batch_history',
      array(
        $id,
      ),
    );
  }
  if (!empty($operations)) {
    return _l10n_update_create_batch($operations);
  }
}