From 90ce0974bdf3c73fac0db1d34373f0551717a121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Tue, 10 Jun 2025 16:08:32 +0200 Subject: [PATCH] MDL-85734 calendar: support multilang group names. --- calendar/lib.php | 4 ++-- calendar/tests/behat/calendar.feature | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index d7691ada9d1..438be90ab8f 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -3642,7 +3642,7 @@ function calendar_output_fragment_event_form($args) { $groupcoursedata = groups_get_course_data($courseid); $formoptions['groups'] = []; foreach ($groupcoursedata->groups as $groupid => $groupdata) { - $formoptions['groups'][$groupid] = $groupdata->name; + $formoptions['groups'][$groupid] = format_string($groupdata->name, false, ['context' => $context]); } } @@ -3686,7 +3686,7 @@ function calendar_output_fragment_event_form($args) { $groupcoursedata = groups_get_course_data($event->courseid); $formoptions['groups'] = []; foreach ($groupcoursedata->groups as $groupid => $groupdata) { - $formoptions['groups'][$groupid] = $groupdata->name; + $formoptions['groups'][$groupid] = format_string($groupdata->name, false, ['context' => $context]); } } diff --git a/calendar/tests/behat/calendar.feature b/calendar/tests/behat/calendar.feature index 14f9951eb89..322e8e27c32 100644 --- a/calendar/tests/behat/calendar.feature +++ b/calendar/tests/behat/calendar.feature @@ -27,8 +27,8 @@ Feature: Perform basic calendar functionality | teacher1 | C1 | teacher | | admin | C1 | editingteacher | And the following "groups" exist: - | name | course | idnumber | - | Group 1 | C1 | G1 | + | name | course | idnumber | + | GroupGrupo 1 | C1 | G1 | And the following "group members" exist: | user | group | | student1 | G1 | @@ -75,7 +75,9 @@ Feature: Perform basic calendar functionality @javascript Scenario: Create a group event - Given I log in as "teacher1" + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And I log in as "teacher1" And I follow "Full calendar" And I set the field "course" to "Course 1" And I create a calendar event: @@ -322,18 +324,23 @@ Feature: Perform basic calendar functionality @javascript Scenario: Changing the event type should clear previous data - Given I am on the "Course 1" course page logged in as admin + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And I am on the "Course 1" course page logged in as admin And I follow "Course calendar" And I press "New event" And I set the following fields to these values: | Event title | Group 1 event | | Type of event | Group | + And I should see "Group 1" + And I should not see "GroupGrupo 1" And I press "Save" And I am on "Course 1" course homepage And I follow "Course calendar" And I click on "Group 1 event" "link" And I should see "Group event" And I should see "Group 1" + And I should not see "GroupGrupo 1" When I click on "Edit" "button" in the "Group 1 event" "dialogue" And I set the following fields to these values: | Event title | My own user event | @@ -369,7 +376,9 @@ Feature: Perform basic calendar functionality @javascript Scenario: Changing the event type from user to anything else should work - Given I log in as "teacher1" + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And I log in as "teacher1" # We need this so we can see the groups. And the following "course enrolments" exist: | user | course | role |