MDL-73784 usertours: Make End tour button's label translatable

We can use the Moodle language format for End tour button's label now
This commit is contained in:
Huong Nguyen
2022-02-07 10:49:51 +07:00
parent d9d068699c
commit 681df03204
3 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -341,7 +341,7 @@ class tour {
*/
public function get_endtourlabel(): string {
if ($this->endtourlabel) {
$label = $this->endtourlabel;
$label = helper::get_string_from_input($this->endtourlabel);
} else if ($this->count_steps() == 1) {
$label = get_string('endonesteptour', 'tool_usertours');
} else {
@@ -60,7 +60,9 @@ $string['editstep'] = 'Editing "{$a}"';
$string['tourisenabled'] = 'Tour is enabled';
$string['enabled'] = 'Enabled';
$string['endtourlabel'] = 'End tour button\'s label';
$string['endtourlabel_help'] = 'You can optionally specify a custom label for the end tour button. The default label is "Got it" for single-step, and "End tour" for multiple-step tours.';
$string['endtourlabel_help'] = 'You can optionally specify a custom label for the end tour button. The default label is "Got it" for single-step, and "End tour" for multiple-step tours..
Alternatively, a language string ID may be entered in the format identifier,component (with no brackets or space after the comma).';
$string['event_tour_started'] = 'Tour started';
$string['event_tour_reset'] = 'Tour reset';
$string['event_tour_ended'] = 'Tour ended';
@@ -80,3 +80,21 @@ Feature: Steps can be navigated within a tour
And I wait until the page is ready
And I should see "This is the calendar block"
Then I should see "CustomText"
@javascript
Scenario: Customised 'end tour' button text for one step tours can be translatable
Given I log in as "admin"
And I add a new user tour with:
| Name | Calendar tour |
| Description | Calendar tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| End tour button's label | exporttour,tool_usertours |
And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | Enter manually |
And I change window size to "large"
And I follow "Dashboard"
And I wait until the page is ready
And I should see "This is the calendar block"
Then I should see "Export tour"