Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-6236

user editing - Default language not used instead of nonexisting one in user lang field - first lang chosen instead

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.8.1
    • Component/s: Administration
    • Labels:
      None
    • Environment:
      All

      Description

      I was surprised that a number of my users were reporting that their language had been changed to German (Deutsch). What was happening was that when I was editing their user profile, the selected option of the current language was not being set. As a result, it defaulted to the first option on the list and since Deutsch comes before English my users got to practice interpreting German prompts.

      I began by looking in the /user/edit.html file and saw a call to /lib/weblib.php's choose_from_menu funcion

      choose_from_menu ($languages, lang, $user->lang, , , );

      I checked the value of $user->lang and it is set to 'en' yet the values returned by the get_list_of_languages() function called in /user/edit.html produces:

      <th>Preferred language:</th>

      <td>userLang: en<br><select id=menulang name=lang >

      <option value=de_utf8>Deutsch (de)</option>

      <option value=en_us_utf8>English (en_us)</option>

      <option value=en_utf8>English (en)</option>

      <option value=es_es_utf8>Español - España (es_es)</option>

      <option value=es_mx_utf8>Español - Mexico (es_mx)</option>

      <option value=it_utf8>Italiano (it)</option>

      <option value=vi_utf8>Vietnamese (vi)</option>

      In weblib.php there is the comparison:

      if ((string)$value == (string)$selected)

      { $output .= ' selected=selected'; }

      Since 'en' does not match anything in the list it does not by default match the current user's language selection.

        Attachments

          Activity

            People

            Assignee:
            lazyfish Yu Zhang
            Reporter:
            aborrow Anthony Borrow
            Tester:
            Nobody Nobody
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jun/07