You are here

function i18n_string_refresh_batch in Internationalization 7

Create batch for refreshing strings

Parameters

$groups: Array of text groups to refresh

$delete: Optional, delete existing (but not refresed, strings and translations)

1 call to i18n_string_refresh_batch()
i18n_string_admin_refresh_form_submit in i18n_string/i18n_string.admin.inc
Form submission.

File

i18n_string/i18n_string.admin.inc, line 148
Helper functions for string administration.

Code

function i18n_string_refresh_batch($groups, $delete = FALSE) {
  $operations = array();
  foreach ($groups as $group) {
    $operations[] = array(
      '_i18n_string_batch_refresh_prepare',
      array(
        $group,
      ),
    );

    // First try to find string list
    $operations[] = array(
      '_i18n_string_batch_refresh_list',
      array(
        $group,
      ),
    );

    // Then invoke refresh callback
    $operations[] = array(
      '_i18n_string_batch_refresh_callback',
      array(
        $group,
      ),
    );
    if ($delete) {
      $operations[] = array(
        '_i18n_string_batch_refresh_cleanup',
        array(
          $group,
        ),
      );
    }

    // Output group summary
    $operations[] = array(
      '_i18n_string_batch_refresh_summary',
      array(
        $group,
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'title' => t('Refreshing user defined strings'),
    'init_message' => t('Starting string refresh'),
    'error_message' => t('Error refreshing user defined strings'),
    'file' => drupal_get_path('module', 'i18n_string') . '/i18n_string.admin.inc',
  );
  return $batch;
}