Commit 81021d4a authored by Nigel McNie's avatar Nigel McNie
Browse files

Fixed bug #712 - now 'site default' is allowed as a language setting for...

Fixed bug #712 - now 'site default' is allowed as a language setting for people. Newly registered users have this default, so if the site language is something else, they will be using that by default.
parent 7da8dc43
......@@ -120,7 +120,7 @@ $elements['lang'] = array(
'type' => 'select',
'defaultvalue' => $prefs->lang,
'title' => get_string('language', 'account'),
'options' => get_languages(),
'options' => array_merge(array('default' => get_string('sitedefault', 'admin')), get_languages()),
'rules' => array(
'required' => true
),
......
......@@ -106,6 +106,7 @@ $string['pathtofiledescription'] = 'Filesystem path to the \'file\' program';
$string['sessionlifetime'] = 'Session lifetime';
$string['sessionlifetimedescription'] = 'Time in minutes after which an inactive logged in user will be automatically logged out';
$string['setsiteoptionsfailed'] = 'Failed setting the %s option';
$string['sitedefault'] = 'Site Default';
$string['sitelanguagedescription'] = 'The default language for the site';
$string['sitename'] = 'Site name';
$string['sitenamedescription'] = ' ';
......
......@@ -669,9 +669,12 @@ function print_object($mixed) {
*/
function current_language() {
global $USER, $CFG;
if ($USER instanceof User && null !== ($lang = $USER->get_account_preference('lang'))) {
if ($USER instanceof User) {
$lang = $USER->get_account_preference('lang');
if ($lang !== null && $lang != 'default') {
return $lang;
}
}
if (!empty($CFG->lang)) {
return $CFG->lang;
}
......
......@@ -158,7 +158,7 @@ function expected_account_preferences() {
return array('friendscontrol' => 'auth',
'wysiwyg' => 1,
'messages' => 'allow',
'lang' => 'en.utf8' // @todo NOTE: should actually be 'site default' when that bug is fixed
'lang' => 'default',
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment