You are here

function l10n_update_batch_update_build in Localization update 7.2

Builds a batch to check, download and import project translations.

Parameters

array $projects: Array of project names for which to update the translations. Defaults to all translatable projects.

array $langcodes: Array of language codes. Defaults to all translatable languages.

array $options: Array of import options. See locale_translate_batch_import_files().

Return value

array Batch definition array.

5 calls to l10n_update_batch_update_build()
drush_l10n_update in ./l10n_update.drush.inc
Callback for command l10n-update.
l10n_update_cron_fill_queue in ./l10n_update.translation.inc
Populate a queue with project to check for translation updates.
l10n_update_languages_changed_submit in ./l10n_update.module
Additional submit handler for language forms.
l10n_update_status_form_submit in ./l10n_update.admin.inc
Form submission handler for locale_translation_status_form().
l10n_update_system_update in ./l10n_update.module
Imports translations when new modules or themes are installed.

File

./l10n_update.fetch.inc, line 29
The API for download and import of translations.

Code

function l10n_update_batch_update_build($projects = array(), $langcodes = array(), $options = array()) {
  module_load_include('compare.inc', 'l10n_update');
  $projects = $projects ? $projects : array_keys(l10n_update_get_projects());
  $langcodes = $langcodes ? $langcodes : array_keys(l10n_update_translatable_language_list());
  $status_options = $options;
  $status_options['finish_feedback'] = FALSE;

  // Check status of local and remote translation files.
  $operations = _l10n_update_batch_status_operations($projects, $langcodes, $status_options);

  // Download and import translations.
  $operations = array_merge($operations, _l10n_update_fetch_operations($projects, $langcodes, $options));
  $batch = array(
    'operations' => $operations,
    'title' => t('Updating translations'),
    'progress_message' => '',
    'error_message' => t('Error importing translation files'),
    'finished' => 'l10n_update_batch_fetch_finished',
    'file' => drupal_get_path('module', 'l10n_update') . '/l10n_update.batch.inc',
  );
  return $batch;
}