Moodle
  1. Moodle
  2. MDL-8249

Localised standard role names and descriptions

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.1, 2.1, 2.2, 2.3, 2.4
    • Fix Version/s: 2.4
    • Component/s: Roles / Access
    • Labels:
    • Testing Instructions:
      Hide

      1/ fresh new install, create some new roles, create a few course and rename some roles in them including the course contact role and enrol users to course + create some groups
      2/ test following areas, verify role names are displayed correctly (that is make sure localised role names are present, no blank names)

      • system role definitions and management
      • role management in all other context levels
      • roles in admin settings - search for "role" in admin tree
      • perform back and restore on other system
      • override role name alias
      • verify course contact roles are visible on /index.php and /course/info.php
      • verify main enrol UI role names
      • verify role names in enrol plugins settings pages and instance forms
      • verify group UI including autogroup script
      • verify mod_url extra parameters (you need to enable it in mod_url settings first)
      • verify all reports
      • verify user profile roles
      • verify role option in user selector (bulk files or list of all users)

      3/ try upgrade of existing site
      4/ try manually emptying names and descriptions of standard roles
      5/ try switching language again and verify names and descriptions are fully localised
      6/ review new help icons for role short name, full name and description on role definition page
      7/ verify form validation - empty full names are allowed for standard roles only

      Show
      1/ fresh new install, create some new roles, create a few course and rename some roles in them including the course contact role and enrol users to course + create some groups 2/ test following areas, verify role names are displayed correctly (that is make sure localised role names are present, no blank names) system role definitions and management role management in all other context levels roles in admin settings - search for "role" in admin tree perform back and restore on other system override role name alias verify course contact roles are visible on /index.php and /course/info.php verify main enrol UI role names verify role names in enrol plugins settings pages and instance forms verify group UI including autogroup script verify mod_url extra parameters (you need to enable it in mod_url settings first) verify all reports verify user profile roles verify role option in user selector (bulk files or list of all users) 3/ try upgrade of existing site 4/ try manually emptying names and descriptions of standard roles 5/ try switching language again and verify names and descriptions are fully localised 6/ review new help icons for role short name, full name and description on role definition page 7/ verify form validation - empty full names are allowed for standard roles only
    • Workaround:
      Hide

      none!

      Show
      none!
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w28_MDL-8249_m24_roletranslations
    • Rank:
      3444

      Description

      Originally the names for student and teacher could be changed in courses, I guess we could simulate it now with:

      1/ empty role name means use shortname to get rolename using get_string(); if name present in role definition use format_string() that handles multilang names
      2/ add role name plural field to handle plurals correctly
      3/ add function get_role_name() and get_role_name_plural() and search&replace in codebase

      ideas?

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          MOstly I agree (especially I like the idea of using shortname as a string name in language packs).

          Some thinking out loud ...:

          1) We still need some sort of GUI so that teachers have more control over role names for each context. This would be something stored in a new table maybe. roleid contextid forcename

          2) However, following on from this Roles can be confusing enough already ... I'm a bit worried about how confusing it could be once roles can have different names in different places ...

          We need to discuss all this further I think ...

          Show
          Martin Dougiamas added a comment - MOstly I agree (especially I like the idea of using shortname as a string name in language packs). Some thinking out loud ...: 1) We still need some sort of GUI so that teachers have more control over role names for each context. This would be something stored in a new table maybe. roleid contextid forcename 2) However, following on from this Roles can be confusing enough already ... I'm a bit worried about how confusing it could be once roles can have different names in different places ... We need to discuss all this further I think ...
          Hide
          Ralf Hilgenstock added a comment -

          The option to change the role name of teachers and students was an often used feature in 1.6 and before. I couldn't see any confusing.

          There is an discussion about this topic at: http://moodle.org/mod/forum/discuss.php?d=58764

          Show
          Ralf Hilgenstock added a comment - The option to change the role name of teachers and students was an often used feature in 1.6 and before. I couldn't see any confusing. There is an discussion about this topic at: http://moodle.org/mod/forum/discuss.php?d=58764
          Show
          Robert Brenstein added a comment - See also http://moodle.org/mod/forum/discuss.php?d=59900#274302
          Hide
          Robert Brenstein added a comment -

          Being able to have Role names in multiple languages, that is switchable through multilang filter, can be an important issue for sites which are multilingual. It has always been a sore to the eyes to have the entire GUI change language from, let's say German to English, but have the Teacher further referred to as "Lehrer". Or as it is now in 1.7, when I go to the Role defining page while using Moodle in Polish and have all in Polish except for the role names and their description.

          The idea of using language files for Roles sounds really appealing to me. So does having plurals. Being able to edit role names and descirptions by editing language file (roles.php?) would make the interface simpler.

          Show
          Robert Brenstein added a comment - Being able to have Role names in multiple languages, that is switchable through multilang filter, can be an important issue for sites which are multilingual. It has always been a sore to the eyes to have the entire GUI change language from, let's say German to English, but have the Teacher further referred to as "Lehrer". Or as it is now in 1.7, when I go to the Role defining page while using Moodle in Polish and have all in Polish except for the role names and their description. The idea of using language files for Roles sounds really appealing to me. So does having plurals. Being able to edit role names and descirptions by editing language file (roles.php?) would make the interface simpler.
          Hide
          David Mudrak added a comment -

          +1 for skodak's proposal. This implies to extend current functionality of lang.php, so site admins are allowed to add _local strings not being present in master package (so called orphaned strings). Or to create a special GUI for translating rolenames.

          -1 for renaming roles in different context. There is already a workaround: duplicate a role and rename it. Roles may be quite difficult to manage right now, let us not make it even more difficult. Or - maybe, a special role type behaving like a symlink to another role? Could legacy roles be used for this?

          Show
          David Mudrak added a comment - +1 for skodak's proposal. This implies to extend current functionality of lang.php, so site admins are allowed to add _local strings not being present in master package (so called orphaned strings). Or to create a special GUI for translating rolenames. -1 for renaming roles in different context. There is already a workaround: duplicate a role and rename it. Roles may be quite difficult to manage right now, let us not make it even more difficult. Or - maybe, a special role type behaving like a symlink to another role? Could legacy roles be used for this?
          Hide
          Séverin Terrier added a comment -

          I totally agree with David Mudrak !

          Show
          Séverin Terrier added a comment - I totally agree with David Mudrak !
          Hide
          Leang Chumsoben added a comment - - edited

          I have no comment on how to solve the problem but I totally agree with the suggestion (see also my proposal http://moodle.org/mod/forum/discuss.php?d=78700 )

          Just a small addition; It would be also great if we can translate the ":" symbol next to the word "Teacher" in the course description. Not all languages (at least Khmer) use that symbol.

          Show
          Leang Chumsoben added a comment - - edited I have no comment on how to solve the problem but I totally agree with the suggestion (see also my proposal http://moodle.org/mod/forum/discuss.php?d=78700 ) Just a small addition; It would be also great if we can translate the ":" symbol next to the word "Teacher" in the course description. Not all languages (at least Khmer) use that symbol.
          Hide
          David Mudrak added a comment -

          See MDL-12192 for translating ":" issue.

          Show
          David Mudrak added a comment - See MDL-12192 for translating ":" issue.
          Hide
          Petr Škoda added a comment -

          I have a patch that seems to work fine and does not require any major changes, testing...

          Show
          Petr Škoda added a comment - I have a patch that seems to work fine and does not require any major changes, testing...
          Hide
          Petr Škoda added a comment - - edited

          patch attached, I am going to test it a bit more by going through all affected parts of UI and submit for integration...

          Show
          Petr Škoda added a comment - - edited patch attached, I am going to test it a bit more by going through all affected parts of UI and submit for integration...
          Hide
          Petr Škoda added a comment -

          This should resolve all renaming course role name issues, improve performance a bit in few areas (by eliminating separate queries to role_names table) and it finally shows the names (and descriptions) of default roles in current language.

          Show
          Petr Škoda added a comment - This should resolve all renaming course role name issues, improve performance a bit in few areas (by eliminating separate queries to role_names table) and it finally shows the names (and descriptions) of default roles in current language.
          Hide
          Nicolas Martignoni added a comment -

          Would like to test, but unable since the patch seems not to be in 2.3dev yet. Any simple way to test without git geekery (which I don't master )?

          Show
          Nicolas Martignoni added a comment - Would like to test, but unable since the patch seems not to be in 2.3dev yet. Any simple way to test without git geekery (which I don't master )?
          Hide
          Petr Škoda added a comment -

          Hi, you can checkout my git branch from github or download a zip archive with all necessary files.

          Show
          Petr Škoda added a comment - Hi, you can checkout my git branch from github or download a zip archive with all necessary files.
          Hide
          Petr Škoda added a comment - - edited

          https://github.com/skodak/moodle/tree/w21_MDL-8249_m23_roletranslations use the Zip button it the upper left part of page.

          Show
          Petr Škoda added a comment - - edited https://github.com/skodak/moodle/tree/w21_MDL-8249_m23_roletranslations use the Zip button it the upper left part of page.
          Hide
          Nicolas Martignoni added a comment -

          Thanks Petr.

          Partially tested (unable to test everything). Works as described and beautifully. Congrats! Hope this will land in 2.3

          Fixes indeed MDL-20536 too.

          Cheers, Nicolas

          Show
          Nicolas Martignoni added a comment - Thanks Petr. Partially tested (unable to test everything). Works as described and beautifully. Congrats! Hope this will land in 2.3 Fixes indeed MDL-20536 too. Cheers, Nicolas
          Hide
          Nicolas Martignoni added a comment -

          MDL-8076 should be closed as duplicate too, since this patch resolves it.

          Show
          Nicolas Martignoni added a comment - MDL-8076 should be closed as duplicate too, since this patch resolves it.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          This seems quite risky to be able to land in 2.3 when we already have a lot of open regressions to sort out.

          Show
          Dan Poltawski added a comment - This seems quite risky to be able to land in 2.3 when we already have a lot of open regressions to sort out.
          Hide
          Petr Škoda added a comment -

          Yes, I knew this is a tricky fix, that is why I submitted it for integration last moth before the expected freeze. Let's hope this gets accepted after the master is opened for 2.4dev. Thanks

          Show
          Petr Škoda added a comment - Yes, I knew this is a tricky fix, that is why I submitted it for integration last moth before the expected freeze. Let's hope this gets accepted after the master is opened for 2.4dev. Thanks
          Hide
          Dan Poltawski added a comment -

          Taking integration held issues out of integration (whilst we are keeping master and 23_STABLE in sync).

          Show
          Dan Poltawski added a comment - Taking integration held issues out of integration (whilst we are keeping master and 23_STABLE in sync).
          Hide
          Ray Lawrence added a comment -

          How is this different to the aliases that are already possible on the course settings page?

          Ray

          Show
          Ray Lawrence added a comment - How is this different to the aliases that are already possible on the course settings page? Ray
          Hide
          Petr Škoda added a comment -

          Very different, my patch takes the role names from language packs instead of hardcoding it in database.

          Show
          Petr Škoda added a comment - Very different, my patch takes the role names from language packs instead of hardcoding it in database.
          Hide
          Ray Lawrence added a comment -

          Great.

          Show
          Ray Lawrence added a comment - Great.
          Hide
          Dan Poltawski added a comment -

          Hi Petr,

          I've integrated this now.

          Question: should we be 'upgrading' standard roles which haven't been edited to have a blank name/description and thus be automatically transalable?

          It, looks like a php 5.4-ism slipped in breaking tests, which I quickly fixed so it could be integrated:

          There was 1 error:
          
          1) accesslib_testcase::test_get_user_roles_in_course
          preg_match_all() expects at least 3 parameters, 2 given
          
          /Users/danp/git/integration/lib/tests/accesslib_test.php:1329
          /Users/danp/git/integration/lib/phpunit/classes/advanced_testcase.php:76
          
          To re-run:
           phpunit accesslib_testcase lib/tests/accesslib_test.php
          
          FAILURES!
          Tests: 1327, Assertions: 25153, Errors: 1.
          

          Note, it would've been nice to have more info there as the phpdoc on get_user_roles_in_course is crappy (can't tell that its returning comma seperated!).

          Added the docs_reuqired tag as this needs some docs.
          cheers,
          dan

          Show
          Dan Poltawski added a comment - Hi Petr, I've integrated this now. Question: should we be 'upgrading' standard roles which haven't been edited to have a blank name/description and thus be automatically transalable? It, looks like a php 5.4-ism slipped in breaking tests, which I quickly fixed so it could be integrated: There was 1 error: 1) accesslib_testcase::test_get_user_roles_in_course preg_match_all() expects at least 3 parameters, 2 given /Users/danp/git/integration/lib/tests/accesslib_test.php:1329 /Users/danp/git/integration/lib/phpunit/classes/advanced_testcase.php:76 To re-run: phpunit accesslib_testcase lib/tests/accesslib_test.php FAILURES! Tests: 1327, Assertions: 25153, Errors: 1. Note, it would've been nice to have more info there as the phpdoc on get_user_roles_in_course is crappy (can't tell that its returning comma seperated!). Added the docs_reuqired tag as this needs some docs. cheers, dan
          Hide
          Petr Škoda added a comment -

          Hi Dan, I was not sure about the upgrade path either and in the end I have decided to not do it, because it should be relatively easy for admins to modify the roles manually.

          Show
          Petr Škoda added a comment - Hi Dan, I was not sure about the upgrade path either and in the end I have decided to not do it, because it should be relatively easy for admins to modify the roles manually.
          Hide
          Michael de Raadt added a comment -

          Test result: Problem during testing

          There was a problem when you clicked on the role name of a user while viewing their course level profile. The following error was produced.

          No participants found for this course
          
          More information about this error
          Debug info:
          Error code: noparticipants
          Stack trace:
          
              line 467 of \lib\setuplib.php: moodle_exception thrown
              line 76 of \user\index.php: call to print_error()
          

          To reproduce:

          1. Log in as teacher/admin
          2. Navigate to a course with enrolled users
          3. Click on Participants below the course name in the Navigation block
          4. Click on the name of a user
          5. Click on the linked role name labelled "Roles:"

          For the help strings on the role definitions form, here are some suggestions...

          Short name

          Role short name is a low level role identifier in which only ASCII alphanumeric characters are allowed.

          Custom full name

          Names of standard roles are localised automatically if the custom name is empty. You must provide a full name for all custom roles.

          Show
          Michael de Raadt added a comment - Test result: Problem during testing There was a problem when you clicked on the role name of a user while viewing their course level profile. The following error was produced. No participants found for this course More information about this error Debug info: Error code: noparticipants Stack trace: line 467 of \lib\setuplib.php: moodle_exception thrown line 76 of \user\index.php: call to print_error() To reproduce: Log in as teacher/admin Navigate to a course with enrolled users Click on Participants below the course name in the Navigation block Click on the name of a user Click on the linked role name labelled "Roles:" For the help strings on the role definitions form, here are some suggestions... Short name Role short name is a low level role identifier in which only ASCII alphanumeric characters are allowed. Custom full name Names of standard roles are localised automatically if the custom name is empty. You must provide a full name for all custom roles.
          Hide
          Petr Škoda added a comment -

          evaluating and fixing, thanks

          Show
          Petr Škoda added a comment - evaluating and fixing, thanks
          Hide
          Petr Škoda added a comment -

          Two commits added, thanks a lot Michael.

          Integrators please merge, thanks.

          Show
          Petr Škoda added a comment - Two commits added, thanks a lot Michael. Integrators please merge, thanks.
          Hide
          Dan Poltawski added a comment -

          Pulled that in, thanks guys.

          Show
          Dan Poltawski added a comment - Pulled that in, thanks guys.
          Hide
          Michael de Raadt added a comment -

          Test result: Success

          Show
          Michael de Raadt added a comment - Test result: Success
          Hide
          Dan Poltawski added a comment -

          Congratulations!

          You've made it into the weekly release!

          Thanks for your contribution - here are some random drummers to keep you inspired for the next week!
          http://www.youtube.com/watch?v=_QhpHUmVCmY

          Show
          Dan Poltawski added a comment - Congratulations! You've made it into the weekly release! Thanks for your contribution - here are some random drummers to keep you inspired for the next week! http://www.youtube.com/watch?v=_QhpHUmVCmY
          Hide
          Andrew Nicols added a comment -

          Looks like the install.xml change didn't utilise the XMLDB editor and now we've got some changes to the file for other changes.

          Not sure what the correct way of fixing this is...

          Show
          Andrew Nicols added a comment - Looks like the install.xml change didn't utilise the XMLDB editor and now we've got some changes to the file for other changes. Not sure what the correct way of fixing this is...
          Hide
          Andrew Nicols added a comment -
          Show
          Andrew Nicols added a comment - FYI: These are the changes: https://gist.github.com/d928d8b91ffcae29c051
          Hide
          Dan Poltawski added a comment -

          Thanks Andrew, i've reloaded the changes in editor and pushed the changes.

          Show
          Dan Poltawski added a comment - Thanks Andrew, i've reloaded the changes in editor and pushed the changes.
          Hide
          Petr Škoda added a comment -

          Hmm, I remember using the editor, but I guess I was just tweaking the internals for another issue, sorry for the trouble and death to PREV/NEXT.

          Show
          Petr Škoda added a comment - Hmm, I remember using the editor, but I guess I was just tweaking the internals for another issue, sorry for the trouble and death to PREV/NEXT.
          Hide
          Mary Cooch added a comment -

          I see this has the docs_required label but I'm not entirely sure what this is about -so any pointers would be gratefully accepted

          Show
          Mary Cooch added a comment - I see this has the docs_required label but I'm not entirely sure what this is about -so any pointers would be gratefully accepted
          Hide
          Petr Škoda added a comment -

          Hi, in previous versions if you installed Moodle the role names were hardcoded to your current language. That means if you installed Moodle in English then everybody saw "Teacher", "Student" everywhere no matter what language they selected. This change prevents the hardcoding of role names in database, instead the standard role name are taken from current language packs.

          1/ It should "just work" in new installs.
          2/ Existing role names are not changed during upgrade, if admins want this new feature they need to remove the hardcoded role names. I am going to add this info to release notes.
          3/ Developers need to use the new API to get role names because there are no role names stored in database for default roles. This is already documented in enrol/upgrade.txt

          Show
          Petr Škoda added a comment - Hi, in previous versions if you installed Moodle the role names were hardcoded to your current language. That means if you installed Moodle in English then everybody saw "Teacher", "Student" everywhere no matter what language they selected. This change prevents the hardcoding of role names in database, instead the standard role name are taken from current language packs. 1/ It should "just work" in new installs. 2/ Existing role names are not changed during upgrade, if admins want this new feature they need to remove the hardcoded role names. I am going to add this info to release notes. 3/ Developers need to use the new API to get role names because there are no role names stored in database for default roles. This is already documented in enrol/upgrade.txt
          Hide
          Petr Škoda added a comment -

          Should be fixed now in http://docs.moodle.org/dev/Moodle_2.4_release_notes, thanks for reminding me and feel free to improve it. Ciao

          Show
          Petr Škoda added a comment - Should be fixed now in http://docs.moodle.org/dev/Moodle_2.4_release_notes , thanks for reminding me and feel free to improve it. Ciao
          Show
          Petr Škoda added a comment - More info in http://docs.moodle.org/24/en/Managing_roles#Role_name_localisation
          Hide
          Matteo Scaramuccia added a comment -

          Hi,
          a short mention about a possible (read about the way that database has been created) regression when using MS SQL: https://moodle.org/mod/forum/discuss.php?d=219719.

          Show
          Matteo Scaramuccia added a comment - Hi, a short mention about a possible (read about the way that database has been created) regression when using MS SQL: https://moodle.org/mod/forum/discuss.php?d=219719 .
          Hide
          Petr Škoda added a comment -

          Could you please create a new issue for that? I suppose it is a XMLDB editor and DDL layer error. I will need some new unit tests, I personally do not have access to MS SQL Server, sorry.

          Show
          Petr Škoda added a comment - Could you please create a new issue for that? I suppose it is a XMLDB editor and DDL layer error. I will need some new unit tests, I personally do not have access to MS SQL Server, sorry.
          Hide
          Mark Nielsen added a comment -

          Petr Škoda

          2/ Existing role names are not changed during upgrade, if admins want this new feature they need to remove the hardcoded role names. I am going to add this info to release notes.

          What does remove the hardcoded role names mean? Are they records in role_names table?

          Thanks for any info, Cheers!

          Show
          Mark Nielsen added a comment - Petr Škoda 2/ Existing role names are not changed during upgrade, if admins want this new feature they need to remove the hardcoded role names. I am going to add this info to release notes. What does remove the hardcoded role names mean? Are they records in role_names table? Thanks for any info, Cheers!
          Hide
          Petr Škoda added a comment -

          it was describing state of roles table, look at new install and upgraded site - in new install the localised role names are missing

          Show
          Petr Škoda added a comment - it was describing state of roles table, look at new install and upgraded site - in new install the localised role names are missing
          Hide
          Mark Nielsen added a comment -

          Ah, specifically in the role table, name field! Clear that out and it'll used localized role names. Thanks!

          Show
          Mark Nielsen added a comment - Ah, specifically in the role table, name field! Clear that out and it'll used localized role names. Thanks!
          Hide
          Helen Foster added a comment -

          Adding docs_required label so we remember to mention the new setting 'Custom full name' when adding / editing a role in the 2.4 docs wiki.

          Show
          Helen Foster added a comment - Adding docs_required label so we remember to mention the new setting 'Custom full name' when adding / editing a role in the 2.4 docs wiki.
          Hide
          Mary Cooch added a comment -

          Removing docs_required label as this was documented in http://docs.moodle.org/en/Managing_roles and http://docs.moodle.org/en/Creating_custom_roles

          Show
          Mary Cooch added a comment - Removing docs_required label as this was documented in http://docs.moodle.org/en/Managing_roles and http://docs.moodle.org/en/Creating_custom_roles

            People

            • Votes:
              17 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: