From 3db3acfb996f7574a84211431d55c83891b314e6 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 19 Jan 2003 12:32:55 +0000 Subject: [PATCH] Instead of using doclang, use $SESSION->lang, and make it override other language settings. This should fix documentation display, but also will be how setting registration languages and login languages works --- doc/index.php | 2 +- doc/top.php | 6 +----- lib/moodlelib.php | 8 ++++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/index.php b/doc/index.php index 66b6f81290d..e3e07a9e4c9 100644 --- a/doc/index.php +++ b/doc/index.php @@ -8,7 +8,7 @@ optional_variable($lang, ""); // override current language if (!empty($lang)) { - $SESSION->doclang = $lang; + $SESSION->lang = $lang; save_session("SESSION"); } diff --git a/doc/top.php b/doc/top.php index 5d8b4594585..1f32f4d05fd 100644 --- a/doc/top.php +++ b/doc/top.php @@ -2,11 +2,7 @@ require("../config.php"); - if (!empty($SESSION->doclang)) { - $currlang = $SESSION->doclang; - } else { - $currlang = current_language(); - } + $currlang = current_language(); $langs = get_list_of_languages(); $langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index cf5708e4fd8..f19b69fc26c 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -897,10 +897,14 @@ function clean_filename($string) { function current_language() { /// Returns the code for the current language - global $CFG, $USER; + global $CFG, $USER, $SESSION; - if (isset($USER->lang)) { // User language can override site language + if (isset($SESSION->lang)) { // Session language can override other settings + return $SESSION->lang; + + } else if (isset($USER->lang)) { // User language can override site language return $USER->lang; + } else { return $CFG->lang; }