MDL-56527 admin: Improve the error message if download is not available

The previous string did not actually contain a link where the lang pack
could be downloaded from.
This commit is contained in:
David Mudrák 2016-12-09 11:18:31 +01:00
parent 5ef81f2b0b
commit cb425a917f
3 changed files with 19 additions and 4 deletions

View File

@ -208,6 +208,17 @@ class controller {
}
return false;
}
/**
* Returns the URL where a given language pack can be downloaded
*
* Alternatively, if the parameter is empty, returns URL of the page with the
* list of all available language packs.
*
* @param string $langcode language code like 'cs' or empty for unknown
* @return string URL
*/
public function lang_pack_url($langcode = '') {
return $this->installer->lang_pack_url($langcode);
}
}

View File

@ -125,7 +125,11 @@ if ($availablelangs = $controller->availablelangs) {
$remote = false;
$availablelangs = array();
echo $OUTPUT->box_start();
print_string('remotelangnotavailable', 'tool_langimport', $CFG->dataroot.'/lang/');
$a = [
'src' => $controller->lang_pack_url(),
'dest' => $CFG->dataroot.'/lang/',
];
print_string('downloadnotavailable', 'tool_langimport', $a);
echo $OUTPUT->box_end();
}

View File

@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['downloadnotavailable'] = 'Unable to connect to the download server. It is not possible to install or update the language packs automatically. Please download the appropriate ZIP file(s) from <a href="{$a->src}">{$a->src}</a> and unzip them manually to your data directory <code>{$a->dest}</code>';
$string['install'] = 'Install selected language pack(s)';
$string['installedlangs'] = 'Installed language packs';
$string['langimport'] = 'Language import utility';
@ -43,7 +44,6 @@ $string['noenglishuninstall'] = 'The English language pack cannot be uninstalled
$string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed';
$string['pluginname'] = 'Language packs';
$string['purgestringcaches'] = 'Purge string caches';
$string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from <a href="https://download.moodle.org/langpack/">download.moodle.org/langpack</a>, copy them to your {$a} directory and unzip them manually.';
$string['selectlangs'] = 'Select languages to uninstall';
$string['uninstall'] = 'Uninstall selected language pack(s)';
$string['uninstallconfirm'] = 'You are about to completely uninstall these language packs: <strong>{$a}</strong>. Are you sure?';