Moodle

Forcing language to en_us at course level breaks links to help files

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7, 1.7.1, 1.7.2, 1.7.3, 1.8, 1.8.1, 1.8.2, 1.8.3
  • Fix Version/s: 1.7.4, 1.8.4, 1.9, 2.0
  • Component/s: Documentation
  • Labels:
    None
  • Environment:
    OS X 10.4.8
    mysql 5.0.27
    php 5.2.1
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

0. Install English en_us package
1. Set default language to en_us for site
2. Force language to en_us at course level

Afterwards links to help files (via ? icon) are broken. Set Force language option to anything else (en or nothing) yields good links

A link when force language is set to en_us looks like this:
http://ourmoodlesite/moodle/help.php?module=moodle&file=search.html&forcelang=en_us_utf8
which reports "Help file "search.html" could not be found!" even though the link to the index of all help files in this window works fine.

The same link with force language set to en and nothing respectively, look like:
http://ourmoodlesite/moodle/help.php?module=moodle&file=search.html&forcelang=en_utf8
http://ourmoodlesite/moodle/help.php?module=moodle&file=search.html&forcelang=
both of these work.

Issue Links

Activity

Hide
Matthew Davidson added a comment -

This is also broken for 1.8

Show
Matthew Davidson added a comment - This is also broken for 1.8
Hide
Helen Foster added a comment -

Sorry I can't help with this. Reassigning...

Show
Helen Foster added a comment - Sorry I can't help with this. Reassigning...
Hide
Wen Hao Chuang added a comment -

I did some testing and bumped up the priority a little bit. This problem started from 1.7 and got carried over to 1.8 and 1.9. The bottom of the problem is that when you changed the course setting to force language to be English (en_us), after you save changes, when you click on any help button, it will refer to help.php?module=moodle&file=search.html&forcelang=en_us_utf8, while in fact in the /lang folder there is NO such folder called "en_us_utf8", there is, however, a folder called en_utf8. So a quick fix would be duplicate a folder of en_uft8 and call it en_us_utf8 but I don't think this is the ideal way to fix the problem as then you will have TWO identical folders with same content. I will look at this issue more closely and update later.

Show
Wen Hao Chuang added a comment - I did some testing and bumped up the priority a little bit. This problem started from 1.7 and got carried over to 1.8 and 1.9. The bottom of the problem is that when you changed the course setting to force language to be English (en_us), after you save changes, when you click on any help button, it will refer to help.php?module=moodle&file=search.html&forcelang=en_us_utf8, while in fact in the /lang folder there is NO such folder called "en_us_utf8", there is, however, a folder called en_utf8. So a quick fix would be duplicate a folder of en_uft8 and call it en_us_utf8 but I don't think this is the ideal way to fix the problem as then you will have TWO identical folders with same content. I will look at this issue more closely and update later.
Hide
Ann Adamcik added a comment -

We resolved this in our installation by adding en_utf8 as a fallback to the lang array in help.php even if forcelang is set:

diff -c -r1.38.2.2 help.php

      • 35,41 ****
        if (empty($forcelang)) { $langs = array(current_language(), get_string('parentlanguage'), 'en_utf8'); // Fallback } else { ! $langs = array($forcelang); }

        — 35,41 ----
        if (empty($forcelang)) { $langs = array(current_language(), get_string('parentlanguage'), 'en_utf8'); // Fallback } } else { ! $langs = array($forcelang, 'en_utf8'); }
Show
Ann Adamcik added a comment - We resolved this in our installation by adding en_utf8 as a fallback to the lang array in help.php even if forcelang is set: diff -c -r1.38.2.2 help.php
      • 35,41 **** if (empty($forcelang)) { $langs = array(current_language(), get_string('parentlanguage'), 'en_utf8'); // Fallback } else { ! $langs = array($forcelang); } — 35,41 ---- if (empty($forcelang)) { $langs = array(current_language(), get_string('parentlanguage'), 'en_utf8'); // Fallback } } else { ! $langs = array($forcelang, 'en_utf8'); }
Hide
Wen Hao Chuang added a comment - - edited

Ann, that is a nice solution, good job!

I also had another finding about this. During the moodle installation, it will ask you which language you want to use (as default), and if you choose en_us, then actually it will install the "English (en)" language pack, not the en_us language pack. As later after installation you could go into the language pack selection and you will find that en_us is listed as "Available language packs". I don't think it suppose to be this way. Just a quick FYI. I think I will create another separate ticket for this.

By the way I think Ann's fix is quite reasonable to fall back to en_utf8 so unless anyone object this idea, I will commit this change to MOODLE_18_STABLE and MOODLE_17_STABLE tomorrow.. thanks!

Show
Wen Hao Chuang added a comment - - edited Ann, that is a nice solution, good job! I also had another finding about this. During the moodle installation, it will ask you which language you want to use (as default), and if you choose en_us, then actually it will install the "English (en)" language pack, not the en_us language pack. As later after installation you could go into the language pack selection and you will find that en_us is listed as "Available language packs". I don't think it suppose to be this way. Just a quick FYI. I think I will create another separate ticket for this. By the way I think Ann's fix is quite reasonable to fall back to en_utf8 so unless anyone object this idea, I will commit this change to MOODLE_18_STABLE and MOODLE_17_STABLE tomorrow.. thanks!
Hide
Martin Dougiamas added a comment -

This looks OK to me. Thanks everyone for the testing. Nicolas, can you check out Ann's fix and check it in?

Show
Martin Dougiamas added a comment - This looks OK to me. Thanks everyone for the testing. Nicolas, can you check out Ann's fix and check it in?
Hide
Nicolas Connault added a comment -

Implemented Ann's patch. No problems

Show
Nicolas Connault added a comment - Implemented Ann's patch. No problems

Dates

  • Created:
    Updated:
    Resolved: