1 locale.bulk.inc locale_translate_batch_build($files, $finish_feedback = FALSE)

Build a locale batch from an array of files.

Parameters

$files: Array of file objects to import.

$finish_feedback: (optional) Whether to give feedback to the user when finished.

Return value

A batch structure or FALSE if $files was empty.:

File

core/modules/locale/locale.bulk.inc, line 234
Mass import-export and batch import functionality for Gettext .po files.

Code

function locale_translate_batch_build($files, $finish_feedback = FALSE) {
  $t = get_t();
  if (count($files)) {
    $operations = array();
    foreach ($files as $file) {
      // We call locale_translate_batch_import for every batch operation.
      $operations[] = array('locale_translate_batch_import', array($file->uri));
    }
    $batch = array(
      'operations' => $operations,
      'title' => $t('Importing interface translations'),
      'init_message' => $t('Starting import'),
      'error_message' => $t('Error importing interface translations'),
      'file' => backdrop_get_path('module', 'locale') . '/locale.bulk.inc',
    );
    if ($finish_feedback) {
      $batch['finished'] = 'locale_translate_batch_finished';
    }
    return $batch;
  }
  return FALSE;
}