locale_translation_batch_status_build

locale_translation_batch_status_build($projects = array(), $langcodes = array())

Builds a batch to get the status of remote and local translation files.

The batch process fetches the state of both local and (if configured) remote translation files. The data of the most recent translation is stored per per project and per language. This data is stored in a state variable 'locale.translation_status'. The timestamp it was last updated is stored in the state variable 'locale.translation_last_checked'.

Parameters

array $projects: Array of project names for which to check the state of translation files. Defaults to all translatable projects.

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

Return value

array Batch definition array.

File

core/modules/locale/locale.compare.inc, line 234
The API for comparing project translation status with available translation.

Code

function locale_translation_batch_status_build($projects = array(), $langcodes = array()) {
  $projects = $projects ? $projects : array_keys(locale_translation_get_projects());
  $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list());
  $options = _locale_translation_default_update_options();

  $operations = _locale_translation_batch_status_operations($projects, $langcodes, $options);

  $batch = array(
    'operations' => $operations,
    'title' => t('Checking translations'),
    'progress_message' => '',
    'finished' => 'locale_translation_batch_status_finished',
    'error_message' => t('Error checking translation updates.'),
    'file' => drupal_get_path('module', 'locale') . '/locale.batch.inc',
  );
  return $batch;
}
doc_Drupal
2016-10-29 09:24:22
Comments
Leave a Comment

Please login to continue.