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

Set language in user profile during account auto-creation based on browser language instead of admin setting

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites:

      • Use a Moodle instance where user accounts are created automatically upon first login, e.g. from LDAP.
      • Prepare 3 user accounts which will be created on the fly upon first login
      • Login as admin
      • Install the german language pack besides the english language pack
      • Go to Site administration > Language > Language settings
        • Set "Language autodetect" = Yes
        • Set "Default language" = German
        • Set "Use language that is auto detected from users browser during user creation" = Yes
      • Logout

      Scenario 1

      • Set your preferred browser language to german
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in german as this language was autodetected for you
      • Login with user 1

      Expected result:

      • User 1 will have the german language set in his user profile as this was his preferred browser language when his account was created.

      Scenario 2

      • Set your preferred browser language to english
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in english as this language was autodetected for you
      • Login with user 2

      Expected result:

      • User 2 will have the english language set in his user profile as this was his preferred browser language when his account was created.

      Scenario 3

      • Set your preferred browser language to french
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in german as there isn't a language pack installed for the autodetected french language and as german, the site's standard language, is used as fallback.
      • Login with user 3

      Expected result:

      • User 3 will have the german language set in his user profile as there isn't a language pack installed for his preferred browser language and as german, the site's standard language, is used as fallback.
      Show
      Prerequisites: Use a Moodle instance where user accounts are created automatically upon first login, e.g. from LDAP. Prepare 3 user accounts which will be created on the fly upon first login Login as admin Install the german language pack besides the english language pack Go to Site administration > Language > Language settings Set "Language autodetect" = Yes Set "Default language" = German Set " Use language that is auto detected from users browser during user creation " = Yes Logout Scenario 1 Set your preferred browser language to german Clear your browser caches and cookies Go to the Moodle login page Verify that you see Moodle in german as this language was autodetected for you Login with user 1 Expected result: User 1 will have the german language set in his user profile as this was his preferred browser language when his account was created . Scenario 2 Set your preferred browser language to english Clear your browser caches and cookies Go to the Moodle login page Verify that you see Moodle in english as this language was autodetected for you Login with user 2 Expected result: User 2 will have the english language set in his user profile as this was his preferred browser language when his account was created. Scenario 3 Set your preferred browser language to french Clear your browser caches and cookies Go to the Moodle login page Verify that you see Moodle in german as there isn't a language pack installed for the autodetected french language and as german, the site's standard language, is used as fallback. Login with user 3 Expected result: User 3 will have the german language set in his user profile as there isn't a language pack installed for his preferred browser language and as german, the site's standard language, is used as fallback .
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_40_STABLE
    • Pull Master Branch:
      MDL-67419-master

      Description

      Prerequisites:

      • Use a Moodle instance where user accounts are created automatically upon first login, e.g. from LDAP.
      • Prepare 3 user accounts which will be created on the fly upon first login
      • Login as admin
      • Install the german language pack besides the english language pack
      • Set $CFG-> autolang = true
      • Set $CFG-> lang = German
      • Logout

      Scenario 1

      • Set your preferred browser language to german
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in german as this language was autodetected for you
      • Login with user 1

      Expected result:

      • User 1 will have the german language set in his user profile as this was his preferred browser language when his account was created.

      Actual result:

      • User 1 will have the german language set in his user profile as this is the site's standard language and is used for auto-created new accounts

      Scenario 2

      • Set your preferred browser language to english
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in english as this language was autodetected for you
      • Login with user 2

      Expected result:

      • User 2 will have the english language set in his user profile as this was his preferred browser language when his account was created.

      Actual result:

      • User 2 will have the german language set in his user profile as this is the site's standard language and is used for auto-created new accounts*

      Scenario 3

      • Set your preferred browser language to french
      • Clear your browser caches and cookies
      • Go to the Moodle login page
      • Verify that you see Moodle in german as there isn't a language pack installed for the autodetected french language and as german, the site's standard language, is used as fallback.
      • Login with user 3

      Expected result:

      • User 3 will have the german language set in his user profile as there isn't a language pack installed for his preferred browser language and as german, the site's standard language, is used as fallback.

      Actual result:

      • User 3 will have the german language set in his user profile as this is the site's standard language and is used for auto-created new accounts

      Proposal

      The described actual results of the described scenarios might be fine for some Moodle installation, but there are also installations which expect the expected results. Thus, an admin setting is needed.

      We propose to add a new admin setting to /admin/settings.php?section=langsettings called "Choose user account language during account auto-creation" with these values:

      • Set user account language to browser language (Default for new sites which produces the expected behavior described above)
      • Set user account language to default site language (Default for upgraded sites as it's the current actual behavior)

      Alternatively, $CFG->autolang could be extended to cover the additional needs. It would have to be changed from a checkbox to a dropdown setting.

        Attachments

          Activity

            People

            Assignee:
            farhan6318 Farhan Karmali
            Reporter:
            abias Alexander Bias
            Peer reviewer:
            Mihail Geshoski
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, cameron1729, David Mudrák (@mudrd8mz), Helen Foster
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 20 minutes
                4h 20m