-
Improvement
-
Resolution: Fixed
-
Minor
-
2.6
-
MOODLE_26_STABLE
-
MOODLE_27_STABLE
-
mdl27_mdl-43497_allow_force_language_02
-
Whose life this improves: Moodle administrators and Help Desk personnel.
We've been in a situation several times where a problem was reported on a production, in-use Moodle instance, but we had a hard time to investigate the problem because the course-forced language was one we didn't understand. Usually, if it's a european language, we can more or less understand it. However, no one on our team speaks Arabic, for example.
The fix suggested (patch provided) here allows the course forced language to be overridden if the user's role has that capability. By default, this is only possible for admin users. This is done the same way that it's done for $SESSION->lang : you specify it in a get parameter, e.g. http://moodle.example.com/?forcelang=en .
While creating the patch, I investigated all the places where existing Moodle code temporarily changes the current language by setting $SESSION->lang. Everyplace where it made sense (e.g. where the intention is to override the current course and session language), I replaced these with calls to a new function moodle_force_language(), which uses $SESSION->forcelang. $SESSION->forcelang is checked before $course->lang and $SESSION->lang in current_language().