You are here

function drd_server_admin_update_translation in Drupal Remote Dashboard Server 7

Same name and namespace in other branches
  1. 7.2 drd_server.admin.inc \drd_server_admin_update_translation()
1 call to drd_server_admin_update_translation()
drd_server_domain_update_translation in ./drd_server.domain.inc
1 string reference to 'drd_server_admin_update_translation'
drd_server_menu in ./drd_server.module
Implements hook_menu().

File

./drd_server.admin.inc, line 45

Code

function drd_server_admin_update_translation($redirect = TRUE) {
  if (module_exists('l10n_update')) {
    set_time_limit(0);
    module_load_include('admin.inc', 'l10n_update');
    $steps = array(
      t('Refresh information'),
      t('Update translations'),
    );
    foreach ($steps as $step) {
      $projects = l10n_update_get_projects();
      $languages = l10n_update_language_list('name');
      if ($languages) {
        $history = l10n_update_get_history();
        $available = l10n_update_available_releases();
        $updates = l10n_update_build_updates($history, $available);
        $form_state = array(
          'values' => array(
            'op' => $step,
            'mode' => variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP),
            'languages' => array(),
            //send the empty array so that all languages get updated
            'updates' => $updates,
          ),
        );
        $form = array();
        l10n_update_admin_import_form_submit($form, $form_state);
      }
    }
    if (($batch =& batch_get()) && !isset($batch['current_set'])) {
      $batch['progressive'] = TRUE;
      $batch['form_state'] = array(
        'rebuild' => FALSE,
        'programmed' => FALSE,
      );
      batch_process();
    }
  }
  if ($redirect) {
    drupal_goto($_SERVER['HTTP_REFERER']);
  }
}