Moodle

Admin settable default language for front page

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.2, 1.9
  • Fix Version/s: 1.9, 2.0
  • Component/s: Language
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

From Moodle 1.8 on, the default front page language setting is overrided by the browser language configuration. There isn't even mention of this in the help for the page, the release notes or the documentation.

As proposed in MDL-8791 (http://tracker.moodle.org/browse/MDL-8791#action_27506), I've implemented an option in the language settings page to specify if we prefer the browser settings or the admin configured settings.

The attached patches implement it for 1.8 and 19dev, current as of today.

Saludos. Iñaki.

Issue Links

Activity

Hide
Koen Roggemans added a comment -

Thanks for reporting this.
I reassign it to moodle.com.
I've read about this behaviour somewhere, but can't remember where, which is not very useful.

Show
Koen Roggemans added a comment - Thanks for reporting this. I reassign it to moodle.com. I've read about this behaviour somewhere, but can't remember where, which is not very useful.
Hide
Daniel McHugh added a comment -

Koen Roggemans comment stating that this is not a very useful feature is wrong. I'd say its a not very useful implementation. Having the site come up with the default language based on a persons browser is a very good thing, having it so that you cant control it is a bad thing.

I'm an English administrator for an all French site. I need the Administration pages to be in English so I can administrate the site with out learning the language. The site itself is not supposed to have a drip of English in it as it's a french school in Canada. So I need to override this behavior of browser language. Otherwise I'd love the feature of using the Browser language!

Now I know how to operate diffs and patches but it's not something that every one knows how to do or has the ability to do. For those of you that have to manually apply the above file... Locate the section of code in the files shown inside the text and add (Inserts) the code followed by + signs. Don't forget to remove the leading plus signs! I'd copy paste and remove the plus signs. This will make sure you don't get any typos.

For example in the 1.8 file given above find the section at the end that reads:

index bac5fed..427c0b7 100644
— a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -6957,6 +6957,11 @@ function setup_lang_from_browser() { return; }

+ if (empty($CFG->langbrowser)) { + // We prefer configured site default language over browser language. + return; + }
+
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // There isn't list of browser langs, nothing to do return; }

This section of the file is saying in the file lib/moodlelib.php add the lines (note the exclusion of the + signs):

if (empty($CFG->langbrowser)) { // We prefer configured site default language over browser language. return; }

Where I have typed --->>>>>>>>>>>>>>> Insert here <<<<<<<<<<------ :

return;
}

--->>>>>>>>>>>>>>> Insert here <<<<<<<<<<------

if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // There isn't list of browser langs, nothing to do return; } }

Now I mention this exact section in the code as it is really the only confusing addition to be made out of the changes required.

P.S
I now have this patch running and working in Version 1.8.3 by manually editing the file (not to be done without keeping a backup copy of the original files!!!!)

Show
Daniel McHugh added a comment - Koen Roggemans comment stating that this is not a very useful feature is wrong. I'd say its a not very useful implementation. Having the site come up with the default language based on a persons browser is a very good thing, having it so that you cant control it is a bad thing. I'm an English administrator for an all French site. I need the Administration pages to be in English so I can administrate the site with out learning the language. The site itself is not supposed to have a drip of English in it as it's a french school in Canada. So I need to override this behavior of browser language. Otherwise I'd love the feature of using the Browser language! Now I know how to operate diffs and patches but it's not something that every one knows how to do or has the ability to do. For those of you that have to manually apply the above file... Locate the section of code in the files shown inside the text and add (Inserts) the code followed by + signs. Don't forget to remove the leading plus signs! I'd copy paste and remove the plus signs. This will make sure you don't get any typos. For example in the 1.8 file given above find the section at the end that reads: index bac5fed..427c0b7 100644 — a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6957,6 +6957,11 @@ function setup_lang_from_browser() { return; } + if (empty($CFG->langbrowser)) { + // We prefer configured site default language over browser language. + return; + } + if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // There isn't list of browser langs, nothing to do return; } This section of the file is saying in the file lib/moodlelib.php add the lines (note the exclusion of the + signs): if (empty($CFG->langbrowser)) { // We prefer configured site default language over browser language. return; } Where I have typed --->>>>>>>>>>>>>>> Insert here <<<<<<<<<<------ : return; } --->>>>>>>>>>>>>>> Insert here <<<<<<<<<<------ if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // There isn't list of browser langs, nothing to do return; } } Now I mention this exact section in the code as it is really the only confusing addition to be made out of the changes required. P.S I now have this patch running and working in Version 1.8.3 by manually editing the file (not to be done without keeping a backup copy of the original files!!!!)
Hide
Iñaki Arenaza added a comment -

This issue has been fixed in MDL-12570 (which duplicates this bug).

So closing now. Thanks to everybody!

Saludos. Iñaki.

Show
Iñaki Arenaza added a comment - This issue has been fixed in MDL-12570 (which duplicates this bug). So closing now. Thanks to everybody! Saludos. Iñaki.

People

Vote (3)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: