From bb1926ee9589a219567f76f254bb60bbfbb8ce88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Wed, 17 Sep 2025 07:07:40 +0100 Subject: [PATCH] MDL-86668 course: Support filter in scale names. --- course/scales.php | 2 +- grade/tests/behat/grade_custom_scales.feature | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/course/scales.php b/course/scales.php index a478ecdbaff..cfbad60cb40 100644 --- a/course/scales.php +++ b/course/scales.php @@ -69,7 +69,7 @@ if ($scaleid) { $scalemenu = make_menu_from_list($scale->scale); echo $OUTPUT->box_start(); - echo $OUTPUT->heading($scale->name); + echo $OUTPUT->heading(format_string($scale->name, true, ["context" => $context])); echo "
"; echo html_writer::label(get_string('scales'), 'scaleunused'. $scaleid, false, array('class' => 'accesshide')); echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'scaleunused'.$scaleid)); diff --git a/grade/tests/behat/grade_custom_scales.feature b/grade/tests/behat/grade_custom_scales.feature index 631c08065df..ebd363b620e 100644 --- a/grade/tests/behat/grade_custom_scales.feature +++ b/grade/tests/behat/grade_custom_scales.feature @@ -49,3 +49,36 @@ Feature: Custom scales can be used to rate forum discussions | OK | | Pretty Good | | Good | + + @javascript + Scenario: Scales with multilang names do show the correct title in the information popup + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And the following "users" exist: + | username | firstname | lastname | email | + | teacher2 | Teacher | 2 | teacher2@example.com | + And the following "course enrolments" exist: + | user | course | role | + | teacher2 | C1 | teacher | + And the following "scales" exist: + | name | scale | + | StarsEtoliles | ⭐, ⭐⭐, ⭐⭐⭐, ⭐⭐⭐⭐ | + And the following "activities" exist: + | activity | course | name | idnumber | + | forum | C1 | Forum 2 | forum2 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum2 | The egg vs the chicken | Which came first? The egg or the chicken? | + And I am on the "Forum 2" "forum activity editing" page logged in as teacher1 + And I expand all fieldsets + And I set the field "assessed" to "Average of ratings" + And I set the field "scale[modgrade_type]" to "Scale" + And I set the field "scale[modgrade_scale]" to "Stars" + And I press "Save and display" + When I am on the "Forum 2" "forum activity" page logged in as "teacher2" + And I follow "The egg vs the chicken" + And "Scales" "link" should exist + And I click on "Scales" "link" + And I switch to a second window + Then I should see "Stars" + But I should not see "StarsEtoiles"