Two new language variables implemented.

langmenu  - turns the language menu on and off
langlist  - allows the admin to restrict and/or re-order the available language choices
This commit is contained in:
moodler 2003-05-03 06:50:29 +00:00
parent 107b010b43
commit 984a8bf349
8 changed files with 95 additions and 41 deletions

View File

@ -24,6 +24,29 @@
<? print_string("configlangdir") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>langmenu:</td>
<td>
<? unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "langmenu", $config->langmenu, "", "", "");
?>
</td>
<td>
<? print_string("configlangmenu") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>langlist:</td>
<td>
<input name=langlist type=text size=40 value="<?=$config->langlist?>">
</td>
<td>
<? print_string("configlanglist") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>locale:</td>
<td>

View File

@ -2,10 +2,13 @@
require("../config.php");
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true);
if (empty($CFG->langmenu)) {
$langmenu = "";
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
if (! $site = get_site()) {
error("Site is misconfigured");

View File

@ -22,9 +22,13 @@
$loginstring = "<font size=1>".user_login_string($site)."</font>";
}
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/?lang=", $langs, "chooselang", $currlang, "", "", "", true);
if (empty($CFG->langmenu)) {
$langmenu = "";
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
print_header("$site->fullname", "$site->fullname", "home", "",
"<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",

View File

@ -67,6 +67,8 @@ $string['confightmleditor'] = "Choose whether or not to allow use of the embedde
$string['configintro'] = "On this page you can specify a number of configuration variables that help make Moodle work properly on your server. Don't worry too much about it - the defaults will usually work fine and you can always come back to this page later and change these settings.";
$string['configlang'] = "Choose a default language for the whole site. Users can override this setting later.";
$string['configlangdir'] = "Most languages are printed left-to-right, but some, like Arabic and Hebrew, are printed right-to-left.";
$string['configlangmenu'] = "Choose whether or not you want to display the general-purpose language menu on the home page, login page etc. This does not affect the user's ability to set the preferred language in their own profile.";
$string['configlanglist'] = "Leave this blank to allow users to choose from any language you have in this installation of Moodle. However, you can shorten the language menu by entering a comma-separated list of language codes that you want. For example: en,es_es,fr,it";
$string['configlocale'] = "Choose a sitewide locale - this will affect the format and language of dates. You need to have this locale data installed on your operating system. (eg en_US or es_ES). If you don't know what to choose leave it blank.";
$string['configlongtimenosee'] = "If students haven't logged in for a very long time, then they are automatically unsubscribed from courses. This parameter specifies that time limit.";
$string['configloglifetime'] = "This specifies the length of time you want to keep logs about user activity. Logs that are older than this age are automatically deleted. It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime.";

View File

@ -4,31 +4,33 @@
// It defines default values for any important configuration variables
$defaults = array (
"theme" => "standard",
"lang" => "en",
"langdir" => "LTR",
"locale" => "en",
"auth" => "email",
"smtphosts" => "",
"smtpuser" => "",
"smtppass" => "",
"gdversion" => 1,
"longtimenosee" => 100,
"loglifetime" => 0,
"zip" => "",
"unzip" => "",
"slasharguments" => 1,
"htmleditor" => true,
"proxyhost" => "",
"proxyport" => "",
"maxeditingtime" => 1800,
"changepassword" => true,
"country" => "",
"prefix" => "",
"debug" => 7,
"framename" => "_top",
"gdversion" => 1,
"guestloginbutton" => 1,
"htmleditor" => true,
"lang" => "en",
"langdir" => "LTR",
"langmenu" => 1,
"langhide" => "",
"locale" => "en",
"loglifetime" => 0,
"longtimenosee" => 100,
"maxeditingtime" => 1800,
"prefix" => "",
"proxyhost" => "",
"proxyport" => "",
"sessiontimeout" => 7200,
"framename" => "_top",
"debug" => 7
"slasharguments" => 1,
"smtphosts" => "",
"smtppass" => "",
"smtpuser" => "",
"theme" => "standard",
"unzip" => "",
"zip" => ""
);
?>

View File

@ -1024,15 +1024,28 @@ function get_list_of_languages() {
/// Returns a list of language codes and their full names
global $CFG;
if (!$langdirs = get_list_of_plugins("lang")) {
return false;
$languages = array();
if (!empty($CFG->langlist)) { // use admin's list of languages
$langlist = explode(',', $CFG->langlist);
foreach ($langlist as $lang) {
if (file_exists("$CFG->dirroot/lang/$lang/moodle.php")) {
include("$CFG->dirroot/lang/$lang/moodle.php");
$languages[$lang] = $string["thislanguage"]." ($lang)";
unset($string);
}
}
} else {
if (!$langdirs = get_list_of_plugins("lang")) {
return false;
}
foreach ($langdirs as $lang) {
include("$CFG->dirroot/lang/$lang/moodle.php");
$languages[$lang] = $string["thislanguage"]." ($lang)";
unset($string);
}
}
foreach ($langdirs as $lang) {
include("$CFG->dirroot/lang/$lang/moodle.php");
$languages[$lang] = $string["thislanguage"]." ($lang)";
unset($string);
}
return $languages;
}

View File

@ -106,9 +106,13 @@
error("No site found!");
}
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
if (empty($CFG->langmenu)) {
$langmenu = "";
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
$loginsite = get_string("loginsite");

View File

@ -57,10 +57,13 @@
$newaccount = get_string("newaccount");
$login = get_string("login");
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
if (empty($CFG->langmenu)) {
$langmenu = "";
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
print_header($newaccount, $newaccount, "<A HREF=\"index.php\">$login</A> -> $newaccount", $focus, "", true, "<div align=right>$langmenu</div>");
include("signup_form.html");