function _locale_batch_build

_locale_batch_build($files, $finished = NULL, $components = array())

Build a locale batch from an array of files.

Parameters

$files: Array of files to import.

$finished: Optional finished callback for the batch.

$components: Optional list of component names the batch covers. Used in the installer.

Return value

A batch structure.

Related topics

File

includes/locale.inc, line 2318
Administration functions for locale.module.

Code

function _locale_batch_build($files, $finished = NULL, $components = array()) {
  $t = get_t();
  if (count($files)) {
    $operations = array();
    foreach ($files as $file) {
      // We call _locale_batch_import for every batch operation.
      $operations[] = array('_locale_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' => 'includes/locale.inc',
      // This is not a batch API construct, but data passed along to the
      // installer, so we know what did we import already.
      '#components' => $components,
    );
    if (isset($finished)) {
      $batch['finished'] = $finished;
    }
    return $batch;
  }
  return FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!locale.inc/function/_locale_batch_build/7.x