You are here

function drush_l10n_update in Localization update 6

Same name and namespace in other branches
  1. 7.2 l10n_update.drush.inc \drush_l10n_update()
  2. 7 l10n_update.drush.inc \drush_l10n_update()

Callback for command l10n-update.

File

./l10n_update.drush.inc, line 113
Drush interface to l10n-update functionalities.

Code

function drush_l10n_update() {
  $updates = _drush_l10n_update_get_updates();
  if (!is_null($updates)) {
    if (count($updates) > 0) {
      drush_log(dt('Found @count projects to update.', array(
        '@count' => count($updates),
      )), 'status');

      // Batch update all projects for selected languages.
      $mode = drush_get_option('mode', 'keep');
      $languages = drush_get_option('languages');
      module_load_include('batch.inc', 'l10n_update');
      $updates = _l10n_update_prepare_updates($updates, NULL, array_keys($languages));
      $batch = l10n_update_batch_multiple($updates, $mode);
      drush_log($batch['title'], 'status');
      drush_log($batch['init_message'], 'status');
      batch_set($batch);
      drush_backend_batch_process();
    }
    else {
      drush_log(dt('Cannot find any translation updates.'), 'ok');
    }
  }
}