You are here

function install_finish_translations in Drupal 10

Same name and namespace in other branches
  1. 8 core/includes/install.core.inc \install_finish_translations()
  2. 9 core/includes/install.core.inc \install_finish_translations()

Finishes importing files at end of installation.

If other projects besides Drupal core have been installed, their translation will be imported here.

Parameters

$install_state: An array of information about the current installation state.

Return value

array An array of batch definitions.

1 string reference to 'install_finish_translations'
install_tasks in core/includes/install.core.inc
Returns a list of all tasks the installer currently knows about.

File

core/includes/install.core.inc, line 1817
API functions for installing Drupal.

Code

function install_finish_translations(&$install_state) {
  \Drupal::moduleHandler()
    ->loadInclude('locale', 'fetch.inc');
  \Drupal::moduleHandler()
    ->loadInclude('locale', 'compare.inc');
  \Drupal::moduleHandler()
    ->loadInclude('locale', 'bulk.inc');

  // Build a fresh list of installed projects. When more projects than core are
  // installed, their translations will be downloaded (if required) and imported
  // using a batch.
  $projects = locale_translation_build_projects();
  $languages = \Drupal::languageManager()
    ->getLanguages();
  $batches = [];
  if (count($projects) > 1) {
    $options = _locale_translation_default_update_options();
    if ($batch = locale_translation_batch_update_build([], array_keys($languages), $options)) {
      $batches[] = $batch;
    }
  }

  // If installing from configuration, detect custom translations in the
  // configuration files.
  if (!empty($install_state['config_install_path']) && \Drupal::service('module_handler')
    ->moduleExists('locale')) {
    $batches[] = _install_config_locale_overrides();
  }

  // Creates configuration translations.
  $batches[] = locale_config_batch_update_components([], array_keys($languages));
  return $batches;
}