Skip to content

Commit e305c29

Browse files
authored
Merge pull request #89 from catalyst/issue85
issue #85: update lang strings
2 parents 4fb77b8 + e00d5a3 commit e305c29

13 files changed

+75
-66
lines changed

classes/local/tool_dynamic_cohorts/condition/cohort_field.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function config_form_add(\MoodleQuickForm $mform): void {
194194
$mform->addElement(
195195
'select',
196196
$this->get_cohort_operator_field(),
197-
get_string('operator', 'tool_dynamic_cohorts'),
197+
get_string('users'),
198198
$this->get_cohort_operators()
199199
);
200200

classes/local/tool_dynamic_cohorts/condition/cohort_membership.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function config_form_add(\MoodleQuickForm $mform): void {
9797
$mform->addElement(
9898
'select',
9999
$this->get_operator_field(),
100-
get_string('operator', 'tool_dynamic_cohorts'),
100+
get_string('users'),
101101
$this->get_operators()
102102
);
103103

lang/en/tool_dynamic_cohorts.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
$string['conditionformtitle'] = 'Rule condition';
5252
$string['condition:auth_method'] = 'Authentication method';
5353
$string['condition:cohort_membership'] = 'Cohort membership';
54-
$string['condition:cohort_membership_description'] = 'A user {$a->operator} {$a->cohorts}';
54+
$string['condition:cohort_membership_description'] = 'Users who {$a->operator} {$a->cohorts}';
5555
$string['condition:cohort_membership_broken_description'] = 'Condition is broken. Using the same cohort that the given rule is configured to manage to.';
5656
$string['condition:cohort_field'] = 'Cohort field';
57-
$string['condition:cohort_field_description'] = 'A user {$a->operator} cohorts with field \'{$a->field}\' {$a->fieldoperator} {$a->fieldvalue}';
57+
$string['condition:cohort_field_description'] = 'Users who {$a->operator} cohorts with field \'{$a->field}\' {$a->fieldoperator} {$a->fieldvalue}';
5858
$string['condition:course_completed'] = 'Course completed';
59-
$string['condition:course_completed_description'] = 'A user has completed course "{$a->course}" {$a->operator} {$a->timecompleted}';
59+
$string['condition:course_completed_description'] = 'Users who have completed course "{$a->course}" {$a->operator} {$a->timecompleted}';
6060
$string['condition:course_not_completed'] = 'Course not completed';
61-
$string['condition:course_not_completed_description'] = 'A user has not completed course "{$a->course}"';
62-
$string['condition:profile_field_description'] = '{$a->field} {$a->fieldoperator} {$a->fieldvalue}';
61+
$string['condition:course_not_completed_description'] = 'Users who have not completed course "{$a->course}"';
62+
$string['condition:profile_field_description'] = 'Users with {$a->field} {$a->fieldoperator} {$a->fieldvalue}';
6363
$string['condition:user_last_login'] = 'User last login';
6464
$string['condition:user_created'] = 'User created time';
6565
$string['condition:user_profile'] = 'User standard profile field';
@@ -83,7 +83,7 @@
8383
$string['enabled'] = 'Enabled';
8484
$string['enable_confirm'] = 'Are you sure you want to enable rule {$a}?';
8585
$string['ever'] = 'Ever';
86-
$string['everloggedin'] = 'A user has logged in at least once';
86+
$string['everloggedin'] = 'Users who have logged in at least once';
8787
$string['event:conditioncreated'] = 'Condition created';
8888
$string['event:conditiondeleted'] = 'Condition deleted';
8989
$string['event:conditionupdated'] = 'Condition updated';
@@ -97,14 +97,14 @@
9797
$string['include_missing_data'] = 'Include users with missing data.';
9898
$string['include_missing_data_help'] = 'Some users may not have a custom field data set yet. This option includes those user in the final result.';
9999
$string['inlast'] = 'In the last';
100-
$string['inlastloggedin'] = 'A user has logged in in the last {$a}';
100+
$string['inlastloggedin'] = 'Users who have logged in in the last {$a}';
101101
$string['invalidfieldvalue'] = 'Invalid field value';
102-
$string['ismemberof'] = 'is member of';
103-
$string['isnotmemberof'] = 'is not member of';
102+
$string['ismemberof'] = 'are members of';
103+
$string['isnotmemberof'] = 'are not members of';
104104
$string['isnotempty'] = 'is not empty';
105105
$string['isafter'] = 'is after';
106106
$string['isbefore'] = 'is before';
107-
$string['loggedintime'] = 'A user logged in {$a->operator} {$a->time}';
107+
$string['loggedintime'] = 'Users who logged in {$a->operator} {$a->time}';
108108
$string['logical_operator'] = 'Logical operator';
109109
$string['logical_operator_help'] = 'A logical operator to be applied to conditions for this rule. Operator "AND" means a user has to match all conditions to be added to a cohort. "OR" means a user has to match any of conditions to be added to a cohort.';
110110
$string['managerules'] = 'Manage rules';
@@ -116,7 +116,7 @@
116116
$string['name'] = 'Rule name';
117117
$string['name_help'] = 'A human readable name of this rule.';
118118
$string['never'] = 'Never';
119-
$string['neverloggedin'] = 'A user has never logged in';
119+
$string['neverloggedin'] = 'Users who have never logged in';
120120
$string['operator'] = 'Operator';
121121
$string['or'] = 'OR';
122122
$string['pleaseselectcohort'] = 'Please select a cohort';
@@ -142,8 +142,8 @@
142142
$string['rule_entity.bulkprocessing'] = 'Bulk processing';
143143
$string['rule_entity.status'] = 'Status';
144144
$string['usercreated'] = 'User was created';
145-
$string['usercreatedin'] = 'A user was created in the last {$a}';
146-
$string['usercreatedtime'] = 'A user was created {$a->operator} {$a->time}';
145+
$string['usercreatedin'] = 'Users who were created in the last {$a}';
146+
$string['usercreatedtime'] = 'Users who were created {$a->operator} {$a->time}';
147147
$string['usersforrule'] = 'Users matching rule "{$a->rule}" for cohort "{$a->cohort}"';
148148
$string['userlastlogin'] = 'User\'s last login';
149149
$string['haverole'] = 'have role';

tests/external/rule_conditions_test.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ public function test_get_conditions_for_rule() {
152152
'{"profilefield":"username","username_operator":3,"username_value":"user1username"}',
153153
$conditions[$condition2->get_record()->get('id')]['configdata']
154154
);
155-
$this->assertSame('Username is equal to user1username', $conditions[$condition2->get_record()->get('id')]['description']);
155+
$this->assertSame(
156+
'Users with Username is equal to user1username',
157+
$conditions[$condition2->get_record()->get('id')]['description']
158+
);
156159
$this->assertSame('User standard profile field', $conditions[$condition2->get_record()->get('id')]['name']);
157160

158161
$this->assertSame($condition3->get('id'), $conditions[$condition3->get('id')]['id']);
@@ -172,7 +175,10 @@ public function test_get_conditions_for_rule() {
172175
'{"profilefield":"username","username_operator":3,"username_value":""}',
173176
$conditions[$condition4->get_record()->get('id')]['configdata']
174177
);
175-
$this->assertSame('Username is equal to user1username', $conditions[$condition2->get_record()->get('id')]['description']);
178+
$this->assertSame(
179+
'Users with Username is equal to user1username',
180+
$conditions[$condition2->get_record()->get('id')]['description']
181+
);
176182
$this->assertSame('User standard profile field', $conditions[$condition2->get_record()->get('id')]['name']);
177183

178184
$this->assertSame(true, $conditions[$condition1->get_record()->get('id')]['broken']);

tests/local/tool_dynamic_cohorts/condition/cohort_field_test.php

+17-14
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,17 @@ public function test_set_and_get_configdata() {
9191
*/
9292
public static function config_description_data_provider(): array {
9393
return [
94-
[condition_base::TEXT_CONTAINS, 'A user is not member of cohorts with field \'Theme\' contains 123'],
95-
[condition_base::TEXT_DOES_NOT_CONTAIN, 'A user is not member of cohorts with field \'Theme\' doesn\'t contain 123'],
96-
[condition_base::TEXT_IS_EQUAL_TO, 'A user is not member of cohorts with field \'Theme\' is equal to 123'],
97-
[condition_base::TEXT_IS_NOT_EQUAL_TO, 'A user is not member of cohorts with field \'Theme\' isn\'t equal to 123'],
98-
[condition_base::TEXT_STARTS_WITH, 'A user is not member of cohorts with field \'Theme\' starts with 123'],
99-
[condition_base::TEXT_ENDS_WITH, 'A user is not member of cohorts with field \'Theme\' ends with 123'],
100-
[condition_base::TEXT_IS_EMPTY, 'A user is not member of cohorts with field \'Theme\' is empty '],
101-
[condition_base::TEXT_IS_NOT_EMPTY, 'A user is not member of cohorts with field \'Theme\' is not empty '],
94+
[condition_base::TEXT_CONTAINS, 'Users who are not members of cohorts with field \'Theme\' contains 123'],
95+
[
96+
condition_base::TEXT_DOES_NOT_CONTAIN,
97+
'Users who are not members of cohorts with field \'Theme\' doesn\'t contain 123',
98+
],
99+
[condition_base::TEXT_IS_EQUAL_TO, 'Users who are not members of cohorts with field \'Theme\' is equal to 123'],
100+
[condition_base::TEXT_IS_NOT_EQUAL_TO, 'Users who are not members of cohorts with field \'Theme\' isn\'t equal to 123'],
101+
[condition_base::TEXT_STARTS_WITH, 'Users who are not members of cohorts with field \'Theme\' starts with 123'],
102+
[condition_base::TEXT_ENDS_WITH, 'Users who are not members of cohorts with field \'Theme\' ends with 123'],
103+
[condition_base::TEXT_IS_EMPTY, 'Users who are not members of cohorts with field \'Theme\' is empty '],
104+
[condition_base::TEXT_IS_NOT_EMPTY, 'Users who are not members of cohorts with field \'Theme\' is not empty '],
102105
];
103106
}
104107

@@ -137,7 +140,7 @@ public function test_config_description_context_id() {
137140
]);
138141

139142
$this->assertSame(
140-
'A user is member of cohorts with field \'Context\' is equal to ' . $coursecategory->name,
143+
'Users who are members of cohorts with field \'Context\' is equal to ' . $coursecategory->name,
141144
$condition->get_config_description()
142145
);
143146
}
@@ -316,7 +319,7 @@ public function test_config_description_custom_field() {
316319
]);
317320

318321
$this->assertSame(
319-
'A user is member of cohorts with field \'Custom field\' is equal to Test value',
322+
'Users who are members of cohorts with field \'Custom field\' is equal to Test value',
320323
$condition->get_config_description()
321324
);
322325

@@ -330,7 +333,7 @@ public function test_config_description_custom_field() {
330333
]);
331334

332335
$this->assertSame(
333-
'A user is member of cohorts with field \'Custom field\' is equal to Yes',
336+
'Users who are members of cohorts with field \'Custom field\' is equal to Yes',
334337
$condition->get_config_description()
335338
);
336339

@@ -342,7 +345,7 @@ public function test_config_description_custom_field() {
342345
]);
343346

344347
$this->assertSame(
345-
'A user is member of cohorts with field \'Custom field\' is equal to No',
348+
'Users who are members of cohorts with field \'Custom field\' is equal to No',
346349
$condition->get_config_description()
347350
);
348351

@@ -357,7 +360,7 @@ public function test_config_description_custom_field() {
357360
]);
358361

359362
$this->assertSame(
360-
'A user is member of cohorts with field \'Custom field\' is after ' . userdate($now),
363+
'Users who are members of cohorts with field \'Custom field\' is after ' . userdate($now),
361364
$condition->get_config_description()
362365
);
363366

@@ -369,7 +372,7 @@ public function test_config_description_custom_field() {
369372
]);
370373

371374
$this->assertSame(
372-
'A user is member of cohorts with field \'Custom field\' is before ' . userdate($now),
375+
'Users who are members of cohorts with field \'Custom field\' is before ' . userdate($now),
373376
$condition->get_config_description()
374377
);
375378
}

tests/local/tool_dynamic_cohorts/condition/cohort_membership_test.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ public function test_config_description() {
102102
'cohort_membership_operator' => cohort_membership::OPERATOR_IS_MEMBER_OF,
103103
'cohort_membership_value' => [$cohort1->id],
104104
]);
105-
$this->assertSame('A user is member of ' . $cohort1->name, $condition->get_config_description());
105+
$this->assertSame('Users who are members of ' . $cohort1->name, $condition->get_config_description());
106106

107107
$condition = $this->get_condition([
108108
'cohort_membership_operator' => cohort_membership::OPERATOR_IS_NOT_MEMBER_OF,
109109
'cohort_membership_value' => [$cohort1->id, $cohort2->id],
110110
]);
111111
$this->assertSame(
112-
'A user is not member of ' . $cohort1->name . ' OR ' . $cohort2->name,
112+
'Users who are not members of ' . $cohort1->name . ' OR ' . $cohort2->name,
113113
$condition->get_config_description()
114114
);
115115

@@ -118,7 +118,7 @@ public function test_config_description() {
118118
'cohort_membership_value' => [$cohort1->id, $cohort2->id, 777],
119119
]);
120120
$this->assertSame(
121-
'A user is member of ' . $cohort1->name . ' OR ' . $cohort2->name . ' OR ' . 777,
121+
'Users who are members of ' . $cohort1->name . ' OR ' . $cohort2->name . ' OR ' . 777,
122122
$condition->get_config_description()
123123
);
124124
}
@@ -218,7 +218,7 @@ public function test_get_broken_description() {
218218
$this->assertSame(
219219
get_string('condition:cohort_membership_broken_description', 'tool_dynamic_cohorts')
220220
. '<br />'
221-
. "A user is member of {$cohort1->name} OR {$cohort2->name}",
221+
. "Users who are members of {$cohort1->name} OR {$cohort2->name}",
222222
$condition->get_broken_description()
223223
);
224224
}

tests/local/tool_dynamic_cohorts/condition/course_completed_test.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function test_config_description() {
102102
]);
103103

104104
$this->assertSame(
105-
'A user has completed course "' . $course->fullname . '" after ' . userdate($now),
105+
'Users who have completed course "' . $course->fullname . '" after ' . userdate($now),
106106
$condition->get_config_description(),
107107
);
108108

@@ -113,7 +113,7 @@ public function test_config_description() {
113113
]);
114114

115115
$this->assertSame(
116-
'A user has completed course "' . $course->fullname . '" before ' . userdate($now),
116+
'Users who have completed course "' . $course->fullname . '" before ' . userdate($now),
117117
$condition->get_config_description(),
118118
);
119119

@@ -124,7 +124,7 @@ public function test_config_description() {
124124
]);
125125

126126
$this->assertSame(
127-
'A user has completed course "' . $course->fullname . '" ',
127+
'Users who have completed course "' . $course->fullname . '" ',
128128
$condition->get_config_description(),
129129
);
130130
}

tests/local/tool_dynamic_cohorts/condition/course_not_completed_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function test_config_description() {
9191
]);
9292

9393
$this->assertSame(
94-
'A user has not completed course "' . $course->fullname . '"',
94+
'Users who have not completed course "' . $course->fullname . '"',
9595
$condition->get_config_description(),
9696
);
9797
}

tests/local/tool_dynamic_cohorts/condition/user_created_test.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ public function test_config_description() {
9999
'period_value' => 1,
100100
'period_type' => 'weeks',
101101
]);
102-
$this->assertSame('A user was created in the last 1 weeks', $condition->get_config_description());
102+
$this->assertSame('Users who were created in the last 1 weeks', $condition->get_config_description());
103103

104104
$condition = $this->get_condition([
105105
'operator' => user_last_login::OPERATOR_BEFORE,
106106
'time' => $now,
107107
'period_value' => 1,
108108
'period_type' => 'weeks',
109109
]);
110-
$this->assertSame('A user was created before ' . userdate($now), $condition->get_config_description());
110+
$this->assertSame('Users who were created before ' . userdate($now), $condition->get_config_description());
111111

112112
$condition = $this->get_condition([
113113
'operator' => user_last_login::OPERATOR_AFTER,
114114
'time' => $now,
115115
'period_value' => 1,
116116
'period_type' => 'weeks',
117117
]);
118-
$this->assertSame('A user was created after ' . userdate($now), $condition->get_config_description());
118+
$this->assertSame('Users who were created after ' . userdate($now), $condition->get_config_description());
119119
}
120120

121121
/**

tests/local/tool_dynamic_cohorts/condition/user_custom_profile_test.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ public function test_set_and_get_configdata() {
150150
*/
151151
public static function config_description_data_provider(): array {
152152
return [
153-
[condition_base::TEXT_CONTAINS, 'Test field1 contains 123', true],
154-
[condition_base::TEXT_DOES_NOT_CONTAIN, 'Test field1 doesn\'t contain 123', true],
155-
[condition_base::TEXT_IS_EQUAL_TO, 'Test field1 is equal to 123', true],
156-
[condition_base::TEXT_IS_NOT_EQUAL_TO, 'Test field1 isn\'t equal to 123', true],
157-
[condition_base::TEXT_STARTS_WITH, 'Test field1 starts with 123', true],
158-
[condition_base::TEXT_ENDS_WITH, 'Test field1 ends with 123', true],
159-
[condition_base::TEXT_IS_EMPTY, 'Test field1 is empty ', true],
160-
[condition_base::TEXT_IS_NOT_EMPTY, 'Test field1 is not empty ', true],
153+
[condition_base::TEXT_CONTAINS, 'Users with Test field1 contains 123', true],
154+
[condition_base::TEXT_DOES_NOT_CONTAIN, 'Users with Test field1 doesn\'t contain 123', true],
155+
[condition_base::TEXT_IS_EQUAL_TO, 'Users with Test field1 is equal to 123', true],
156+
[condition_base::TEXT_IS_NOT_EQUAL_TO, 'Users with Test field1 isn\'t equal to 123', true],
157+
[condition_base::TEXT_STARTS_WITH, 'Users with Test field1 starts with 123', true],
158+
[condition_base::TEXT_ENDS_WITH, 'Users with Test field1 ends with 123', true],
159+
[condition_base::TEXT_IS_EMPTY, 'Users with Test field1 is empty ', true],
160+
[condition_base::TEXT_IS_NOT_EMPTY, 'Users with Test field1 is not empty ', true],
161161
];
162162
}
163163

tests/local/tool_dynamic_cohorts/condition/user_last_login_test.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,37 @@ public function test_config_description() {
9797
'operator' => user_last_login::OPERATOR_EVER,
9898
'time' => $now,
9999
]);
100-
$this->assertSame('A user has logged in at least once', $condition->get_config_description());
100+
$this->assertSame('Users who have logged in at least once', $condition->get_config_description());
101101

102102
$condition = $this->get_condition([
103103
'operator' => user_last_login::OPERATOR_NEVER,
104104
'time' => $now,
105105
]);
106-
$this->assertSame('A user has never logged in', $condition->get_config_description());
106+
$this->assertSame('Users who have never logged in', $condition->get_config_description());
107107

108108
$condition = $this->get_condition([
109109
'operator' => user_last_login::OPERATOR_IN_LAST,
110110
'time' => $now,
111111
'period_value' => 1,
112112
'period_type' => 'weeks',
113113
]);
114-
$this->assertSame('A user has logged in in the last 1 weeks', $condition->get_config_description());
114+
$this->assertSame('Users who have logged in in the last 1 weeks', $condition->get_config_description());
115115

116116
$condition = $this->get_condition([
117117
'operator' => user_last_login::OPERATOR_BEFORE,
118118
'time' => $now,
119119
'period_value' => 1,
120120
'period_type' => 'weeks',
121121
]);
122-
$this->assertSame('A user logged in before ' . userdate($now), $condition->get_config_description());
122+
$this->assertSame('Users who logged in before ' . userdate($now), $condition->get_config_description());
123123

124124
$condition = $this->get_condition([
125125
'operator' => user_last_login::OPERATOR_AFTER,
126126
'time' => $now,
127127
'period_value' => 1,
128128
'period_type' => 'weeks',
129129
]);
130-
$this->assertSame('A user logged in after ' . userdate($now), $condition->get_config_description());
130+
$this->assertSame('Users who logged in after ' . userdate($now), $condition->get_config_description());
131131
}
132132

133133
/**

0 commit comments

Comments
 (0)