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

Web Service language handling improvements for the mobile app

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.5
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      TESTING WS SERVER CHANGES

      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Install two additional language packs in your site via Site administration > Language > Language packs
      3. Set English as Default language in Site administration > Language > Language settings
      4. Create or use an existing user in the platform (no admin) setting his language to English via User preferences > Preferred language
      5. Create a Token in the mobile app service for the student user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. In your browser, open the following url (use your user token and your site URL): http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_webservice_get_site_info&wstoken=12a2a65aeea2a177055e233f9e303218
      7. Check that in the JSON response you see a field “lang” set to “en” (English language)
      8. Now, change the Default language via Site administration > Language > Language packs to other language different than english
      9. Open again the URL and you will still see lang set to en (English language) because is the user language profile
      10. Now, change the user preferred language via User preferences > Preferred language to a different language than English and the Site language
      11. Open again the Url and check that this time lang is set to the language used in the User preferences
      12. Append the following to the URL &moodlewssettinglang=en, an open it again, you will see now that the language is set to English
      13. If you change the value of moodlewssettinglang to any installed language code and open the URL, the lang field must always set to that language

      TESTING WEB SERVICE

      1. As admin go to Site administration > Language > Language settings
      2. Change the following settings: autolang, lang, langmenu, langlist and locale
      3. Open in your browser the following URL (using the previous token and your site URL): http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=tool_mobile_get_public_config&wstoken=12a2a65aeea2a177055e233f9e303218
      4. Check that the returned values for the fields autolang, lang, langmenu, langlist and locale matches the one in the web interface (for checkboxes it will be a 1 when the checkbox is ticked)
      Show
      TESTING WS SERVER CHANGES As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Install two additional language packs in your site via Site administration > Language > Language packs Set English as Default language in Site administration > Language > Language settings Create or use an existing user in the platform (no admin) setting his language to English via User preferences > Preferred language Create a Token in the mobile app service for the student user: Click on Site administration ► Plugins ► Web services ► Manage tokens In your browser, open the following url (use your user token and your site URL): http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_webservice_get_site_info&wstoken=12a2a65aeea2a177055e233f9e303218 Check that in the JSON response you see a field “lang” set to “en” (English language) Now, change the Default language via Site administration > Language > Language packs to other language different than english Open again the URL and you will still see lang set to en (English language) because is the user language profile Now, change the user preferred language via User preferences > Preferred language to a different language than English and the Site language Open again the Url and check that this time lang is set to the language used in the User preferences Append the following to the URL &moodlewssettinglang=en, an open it again, you will see now that the language is set to English If you change the value of moodlewssettinglang to any installed language code and open the URL, the lang field must always set to that language TESTING WEB SERVICE As admin go to Site administration > Language > Language settings Change the following settings: autolang, lang, langmenu, langlist and locale Open in your browser the following URL (using the previous token and your site URL): http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=tool_mobile_get_public_config&wstoken=12a2a65aeea2a177055e233f9e303218 Check that the returned values for the fields autolang, lang, langmenu, langlist and locale matches the one in the web interface (for checkboxes it will be a 1 when the checkbox is ticked)
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-60736-master

      Description

      The mobile app needs to be consistent with Moodle Web language handling so we'd need to do a few changes:

      Add a new WS "moodlewssetting": moodlewssettinglang to allow to set a session language for the WS request.

      Return langsettings information in tool_mobile_get_public_data (autolang, lang, langmenu, langlist, locale) so we know since the beginning which language to use.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Carlos Escobedo
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              David Mudrák (@mudrd8mz)
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/18