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( ...@@ -120,7 +120,7 @@ $elements['lang'] = array(
'type' => 'select', 'type' => 'select',
'defaultvalue' => $prefs->lang, 'defaultvalue' => $prefs->lang,
'title' => get_string('language', 'account'), 'title' => get_string('language', 'account'),
'options' => get_languages(), 'options' => array_merge(array('default' => get_string('sitedefault', 'admin')), get_languages()),
'rules' => array( 'rules' => array(
'required' => true 'required' => true
), ),
......
...@@ -106,6 +106,7 @@ $string['pathtofiledescription'] = 'Filesystem path to the \'file\' program'; ...@@ -106,6 +106,7 @@ $string['pathtofiledescription'] = 'Filesystem path to the \'file\' program';
$string['sessionlifetime'] = 'Session lifetime'; $string['sessionlifetime'] = 'Session lifetime';
$string['sessionlifetimedescription'] = 'Time in minutes after which an inactive logged in user will be automatically logged out'; $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['setsiteoptionsfailed'] = 'Failed setting the %s option';
$string['sitedefault'] = 'Site Default';
$string['sitelanguagedescription'] = 'The default language for the site'; $string['sitelanguagedescription'] = 'The default language for the site';
$string['sitename'] = 'Site name'; $string['sitename'] = 'Site name';
$string['sitenamedescription'] = ' '; $string['sitenamedescription'] = ' ';
......
...@@ -669,8 +669,11 @@ function print_object($mixed) { ...@@ -669,8 +669,11 @@ function print_object($mixed) {
*/ */
function current_language() { function current_language() {
global $USER, $CFG; global $USER, $CFG;
if ($USER instanceof User && null !== ($lang = $USER->get_account_preference('lang'))) { if ($USER instanceof User) {
return $lang; $lang = $USER->get_account_preference('lang');
if ($lang !== null && $lang != 'default') {
return $lang;
}
} }
if (!empty($CFG->lang)) { if (!empty($CFG->lang)) {
return $CFG->lang; return $CFG->lang;
......
...@@ -158,7 +158,7 @@ function expected_account_preferences() { ...@@ -158,7 +158,7 @@ function expected_account_preferences() {
return array('friendscontrol' => 'auth', return array('friendscontrol' => 'auth',
'wysiwyg' => 1, 'wysiwyg' => 1,
'messages' => 'allow', '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