function install_download_additional_translations_operations

Same name and namespace in other branches
  1. 11.x core/includes/install.core.inc \install_download_additional_translations_operations()
  2. 10 core/includes/install.core.inc \install_download_additional_translations_operations()
  3. 9 core/includes/install.core.inc \install_download_additional_translations_operations()
  4. 8.9.x core/includes/install.core.inc \install_download_additional_translations_operations()

Prepares the system for import and downloads additional translations.

Parameters

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

1 call to install_download_additional_translations_operations()
install_import_translations in core/includes/install.core.inc
Imports languages via a batch process during installation.

File

core/includes/install.core.inc, line 1714

Code

function install_download_additional_translations_operations(&$install_state) : void {
  \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');
  $langcode = $install_state['parameters']['langcode'];
  if (!$language = ConfigurableLanguage::load($langcode)) {
    // Create the language if not already shipped with a profile.
    $language = ConfigurableLanguage::createFromLangcode($langcode);
    $standard_languages = LanguageManager::getStandardLanguageList();
    if (isset($standard_languages[$langcode])) {
      // Use the localized language label since the site is being installed
      // with that language.
      $language->setName($standard_languages[$langcode][1]);
    }
  }
  $language->save();
  // If a non-English language was selected, change the default language and
  // remove English.
  if ($langcode != 'en') {
    \Drupal::configFactory()->getEditable('system.site')
      ->set('langcode', $langcode)
      ->set('default_langcode', $langcode)
      ->save();
    \Drupal::service('language.default')->set($language);
    if (empty($install_state['profile_info']['keep_english'])) {
      if ($lang = ConfigurableLanguage::load('en')) {
        $lang->delete();
      }
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.