You are here

function lingotek_admin_prepare_builtins in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lingotek.admin.inc \lingotek_admin_prepare_builtins()
  2. 7.5 lingotek.admin.inc \lingotek_admin_prepare_builtins()
  3. 7.6 lingotek.admin.inc \lingotek_admin_prepare_builtins()
1 call to lingotek_admin_prepare_builtins()
lingotek_admin_additional_translation_settings_form_submit in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 1104

Code

function lingotek_admin_prepare_builtins($additional_operations = array()) {

  // search for all new built-in strings using the potx module, and add
  // them to the locales_source table for lingotek to translate
  $modules_list = lingotek_admin_get_enabled_modules();
  $batch = array(
    'operations' => $additional_operations,
    'title' => t('Gathering translatable strings from all enabled modules'),
    'init_message' => t('Preparing list of modules to be searched for built-in strings...'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('String-gathering process has encountered an error.'),
    'file' => drupal_get_path('module', 'lingotek') . '/lingotek.admin.inc',
  );
  $indexed_modules = variable_get('lingotek_translate_config_indexed_modules');

  // modules previously scanned
  if (!$indexed_modules) {
    $indexed_modules = array();
  }

  // index modules that have not yet been indexed
  foreach ($modules_list as $module) {
    if (!array_key_exists($module->name, $indexed_modules)) {
      $batch['operations'][] = array(
        'lingotek_admin_add_module_index_job',
        array(
          $module,
        ),
      );
    }
  }
  variable_set('lingotek_translate_config_indexed_modules', $modules_list);

  // save current list for next time
  if (isset($batch['operations']) && count($batch['operations']) > 0) {
    $batch['operations'][] = array(
      'lingotek_admin_index_plural_targets',
      array(),
    );
    batch_set($batch);
  }
}