locale_translate_batch_build(array $files, array $options)
Build a locale batch from an array of files.
array $files: Array of file objects to import.
array $options: An array with options that can have the following elements:
array|bool A batch structure or FALSE if $files was empty.
function locale_translate_batch_build(array $files, array $options) { $options += array( 'overwrite_options' => array(), 'customized' => LOCALE_NOT_CUSTOMIZED, 'finish_feedback' => TRUE, ); 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, $options)); } // Save the translation status of all files. $operations[] = array('locale_translate_batch_import_save', array()); // Add a final step to refresh JavaScript and configuration strings. $operations[] = array('locale_translate_batch_refresh', array()); $batch = array( 'operations' => $operations, 'title' => t('Importing interface translations'), 'progress_message' => '', 'error_message' => t('Error importing interface translations'), 'file' => drupal_get_path('module', 'locale') . '/locale.bulk.inc', ); if ($options['finish_feedback']) { $batch['finished'] = 'locale_translate_batch_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/core!modules!locale!locale.bulk.inc/function/locale_translate_batch_build/8.1.x