}
if (!has_capability('moodle/site:langeditmaster', $context, $USER->id, false) && (!$uselocal)) {
- print_error('cannoteditmasterlang');
+ print_error('cannoteditmasterlang', 'error');
}
if ((!has_capability('moodle/site:langeditlocal', $context, $USER->id, false)) && ($uselocal)) {
- print_error('cannotcustomizelocallang');
+ print_error('cannotcustomizelocallang', 'error');
}
$strlanguage = get_string("language");
$stringfiles += lang_extra_locations();
}
if (count($stringfiles) == 0) {
- print_error("Could not find English language pack!");
+ print_error('cannotfindlang', 'error', '', 'English');
}
} elseif ($mode == 'helpfiles') {
$helpfiles = lang_help_standard_locations();
$helpfiles += lang_help_extra_locations();
}
if (count($helpfiles) == 0) {
- print_error("Could not find help files in the English language pack!");
+ print_error("cannotfindhelp", 'error', '', 'English');
}
}
echo $o;
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
- print_error("Could not find English language help files!");
+ print_error("cannotfindhelp", 'error', '', 'English');
}
foreach ($files as $filekey => $file) { // check all the help files.
}
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
- print_error("Could not find English language docs files!");
+ print_error("cannotfinddoc", 'error', '', 'English');
}
foreach ($files as $filekey => $file) { // check all the docs files.
if (!file_exists("$langdir/docs/$file")) {
if (!file_exists($langbase) ){
if (!lang_make_directory($langbase) ){
- print_error('ERROR: Could not create base lang directory ' . $langbase);
+ print_error('cannotcreatelangbase', 'error');
} else {
echo '<div class="notifysuccess">Created directory '.
$langbase .'</div>'."<br />\n";
}
if (!$uselocal && !file_exists($langdir)) {
if (!lang_make_directory($langdir)) {
- print_error('ERROR: Could not create directory '.$langdir);
+ print_error('cannotcreatelangdir', 'error');
} else {
echo '<div class="notifysuccess">Created directory '.
$langdir .'</div>'."<br />\n";
if ($currentfile <> '') {
if (!$fileinfo = lang_get_file_info($currentfile, $stringfiles)) {
- print_error('Unable to find info for: '.$currentfile);
+ print_error('cannotfindinfo', 'error', '', $currentfile);
}
// check the filename is set up correctly, prevents bugs similar to MDL-10920
$location = $fileinfo['location'];
if ($location || $plugin) {
// file in an extra location
if ($currentfile != "{$prefix}{$plugin}.php") {
- print_error("Non-core filename mismatch. The file $currentfile should be {$prefix}{$plugin}.php");
+ print_error('filemismatch', 'error', '', array($currectfile, $prefix, $plugin));
}
if (!$uselocal) {
notify($streditingnoncorelangfile);
} else {
// file in standard location
if ($currentfile != $filename) {
- print_error("Core filename mismatch. The file $currentfile should be $filename");
+ print_error('filemismatch', 'error', '', array($currectfile, $filename, ''));
}
}
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
} else {
- print_error("Could not save the file '$saveinto/$currentfile'!", '', "lang.php?mode=compare&currentfile=$currentfile");
+ print_error('cannotsavefile', 'error', 'lang.php?mode=compare&currentfile=$currentfile', array($saveinto, $currentfile));
}
unset($packstring);
}
if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
} else {
- print_error("Could not save the file '$currentfile'!", '', "lang.php?mode=helpfiles&currentfile=$currentfile&sesskey=$USER->sesskey");
+ print_error('cannotsavefile', 'error', 'lang.php?mode=compare&currentfile=$currentfile', array($saveinto, $currentfile));
}
}
if (!empty($hide) and confirm_sesskey()) {
if (!$module = get_record("modules", "name", $hide)) {
- print_error("Module doesn't exist!");
+ print_error('moduledoesnotexist', 'error');
}
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
// Remember the visibility status in visibleold
if (!empty($show) and confirm_sesskey()) {
if (!$module = get_record("modules", "name", $show)) {
- print_error("Module doesn't exist!");
+ print_error('moduledoesnotexist', 'error');
}
set_field("modules", "visible", "1", "id", $module->id); // Show main module
set_field('course_modules', 'visible', '1', 'visibleold',
} else { // Delete everything!!
if ($delete == "forum") {
- print_error("You can not delete the forum module!!");
+ print_error("cannotdeleteforummudule", 'forum');
}
if (!$module = get_record("modules", "name", $delete)) {
- print_error("Module doesn't exist!");
+ print_error('moduledoesnotexist', 'error');
}
// OK, first delete all the relevant instances from all course sections
/// Get and sort the existing modules
if (!$modules = get_records("modules")) {
- print_error("No modules found!!"); // Should never happen
+ print_error('moduledoesnotexist', 'error');
}
foreach ($modules as $module) {