function install_download_translation
Same name and namespace in other branches
- 11.x core/includes/install.core.inc \install_download_translation()
- 10 core/includes/install.core.inc \install_download_translation()
- 9 core/includes/install.core.inc \install_download_translation()
- 8.9.x core/includes/install.core.inc \install_download_translation()
Download a translation file for the selected language.
Parameters
array $install_state: An array of information about the current installation state.
Return value
array A themed status report, or an exception if there are requirement errors. Upon successful download the page is reloaded and no output is returned.
1 call to install_download_translation()
- install_config_download_translations in core/
includes/ install.core.inc - Replaces install_download_translation() during configuration installs.
File
-
core/
includes/ install.core.inc, line 1416
Code
function install_download_translation(&$install_state) {
// Check whether all conditions are met to download. Download the translation
// for core if possible.
$requirements = install_check_translations($install_state['parameters']['langcode'], $install_state['server_pattern']);
// Render requirements if any warnings or errors returned.
if ($output = install_display_requirements($install_state, $requirements)) {
return $output;
}
$profile = $install_state['parameters']['profile'] ?? NULL;
$profile_path = $install_state['profiles'][$profile]?->getPath();
$profile_version = $install_state['profiles'][$profile]?->info['version'] ?? NULL;
// If we're using a custom profile and we know its version, try to download
// that translation too. If we can't, proceed without it.
if (isset($profile, $profile_path, $profile_version) && !str_starts_with($profile_path, 'core/')) {
install_check_translations($install_state['parameters']['langcode'], $install_state['server_pattern'], $profile, $profile_version);
}
// At least one download was successful, reload the page in the new language.
$install_state['translations'][$install_state['parameters']['langcode']] = TRUE;
if ($install_state['interactive']) {
install_goto(install_redirect_url($install_state));
}
return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.