From 4df7a2ef4f6fa51b7bf5b7c91ecd7d3cee313c2f Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 15 Dec 2007 11:48:34 +0000 Subject: [PATCH] MDL-12570 option to disable lang autodetect from browser --- admin/settings/language.php | 1 + lang/en_utf8/admin.php | 2 ++ lib/moodlelib.php | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/settings/language.php b/admin/settings/language.php index 379e5c03180..0eabf7412de 100644 --- a/admin/settings/language.php +++ b/admin/settings/language.php @@ -7,6 +7,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page // "languageandlocation" settingpage $temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin')); +$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1)); $temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php $temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1)); $temp->add(new admin_setting_langlist()); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 02154cd9ba2..68a2b64aeea 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -18,6 +18,7 @@ $string['antivirus'] = 'Anti-Virus'; $string['appearance'] = 'Appearance'; $string['aspellpath'] = 'Path to aspell'; $string['authentication'] = 'Authentication'; +$string['autolang'] = 'Language autodetect'; $string['autologinguests'] = 'Auto-login guests'; $string['availablelangs'] = 'Available language packs'; $string['backgroundcolour'] = 'Transparent colour'; @@ -58,6 +59,7 @@ $string['configallowuserthemes'] = 'If you enable this, then users will be allow $string['configallusersaresitestudents'] = 'For activities on the front page of the site, should ALL users be considered as students? If you answer \"Yes\", then any confirmed user account will be allowed to participate as a student in those activities. If you answer \"No\", then only users who are already a participant in at least one course will be able to take part in those front page activities. Only admins and specially assigned teachers can act as teachers for these front page activities.'; $string['configvisiblecourses'] = 'Display courses in hidden categories normally'; $string['configauthenticationplugins'] = 'Please choose the authentication plugins you wish to use and arrange them in order of failthrough.'; +$string['configautolang'] = 'Detect default language from browser setting, if disabled site default is used.'; $string['configautologinguests'] = 'Should visitors be logged in as guests automatically when entering courses with guest access?'; $string['configbloglevel'] = 'This setting allows you to restrict the level to which user blogs can be viewed on this site. Note that they specify the maximum context of the VIEWER not the poster or the types of blog posts. Blogs can also be disabled completely if you don\'t want them at all.'; $string['configcachetext'] = 'For larger sites or sites that use text filters, this setting can really speed things up. Copies of texts will be retained in their processed form for the time specified here. Setting this too small may actually slow things down slightly, but setting it too large may mean texts take too long to refresh (with new links, for example).'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 6481e177553..bd35af2f3d5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -7697,7 +7697,7 @@ function setup_lang_from_browser() { global $CFG, $SESSION, $USER; - if (!empty($SESSION->lang) or !empty($USER->lang)) { + if (!empty($SESSION->lang) or !empty($USER->lang) or empty($CFG->autolang)) { // Lang is defined in session or user profile, nothing to do return; }