function locale_translation_batch_status_build

Same name in other branches
  1. 9 core/modules/locale/locale.compare.inc \locale_translation_batch_status_build()
  2. 10 core/modules/locale/locale.compare.inc \locale_translation_batch_status_build()
  3. 11.x core/modules/locale/locale.compare.inc \locale_translation_batch_status_build()

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.

1 call to locale_translation_batch_status_build()
locale_translation_check_projects_batch in core/modules/locale/locale.compare.inc
Gets and stores the status and timestamp of remote po files.

File

core/modules/locale/locale.compare.inc, line 234

Code

function locale_translation_batch_status_build($projects = [], $langcodes = []) {
    $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 = [
        '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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.