You are here

function l10n_update_batch_multiple in Localization update 7

Same name and namespace in other branches
  1. 6 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 modules

File

./l10n_update.batch.inc, line 58
Reusable API for creating and running l10n update batches.

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);
  }
}