function locale_translation_batch_status_fetch_local

Batch operation callback: Check the availability of local po files.

Checks the presence and creation time of po files in the local file system. The file path and the timestamp are stored.

Parameters

array $sources: Array of translation source objects of projects for which to check the state of local po files.

array $context: The batch context array. The collected state is stored in the 'results' parameter of the context.

See also

locale_translation_batch_status_fetch_remote()

locale_translation_batch_status_compare()

1 string reference to 'locale_translation_batch_status_fetch_local'
_locale_translation_batch_status_operations in drupal/core/modules/locale/locale.compare.inc
Helper function to construct batch operations checking remote translation status.

File

drupal/core/modules/locale/locale.batch.inc, line 80
Batch process to check the availability of remote or local po files.

Code

function locale_translation_batch_status_fetch_local($sources, &$context) {
  $t = get_t();

  // Get the status of local translation files and store the result data in the
  // batch results for later processing.
  foreach ($sources as $source) {
    if (isset($source->files[LOCALE_TRANSLATION_LOCAL])) {
      locale_translation_source_check_file($source);

      // If remote data was collected before, we merge it into the newly
      // collected result.
      if (isset($context['results']['sources'][$source->name][$source->langcode])) {
        $source->files[LOCALE_TRANSLATION_REMOTE] = $context['results']['sources'][$source->name][$source->langcode]->files[LOCALE_TRANSLATION_REMOTE];
      }

      // Record success and store the updated source data.
      $context['results']['files'][$source->name] = $source->name;
      $context['results']['sources'][$source->name][$source->langcode] = $source;
    }
  }
  $context['message'] = $t('Checked all translations.');
}