Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-36534 question editing: clean up lang strings.

There were a number of lang strings in suboptimal places.
This commit fixes that, and also removed some unused strings.

AMOS BEGIN
 MOV [addmorechoiceblanks,qtype_multichoice],[addmorechoiceblanks,question]
 MOV [youmustenteramultiplierhere,qtype_calculated],[youmustenteramultiplierhere,qtype_numerical]
AMOS END
  • Loading branch information...
commit 5574862063699039658f0a28449ac911244794d2 1 parent c4b2600
Tim Hunt timhunt authored
1  lang/en/question.php
@@ -23,6 +23,7 @@
23 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 24 */
25 25
  26 +$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
26 27 $string['addcategory'] = 'Add category';
27 28 $string['adminreport'] = 'Report on possible problems in your question database.';
28 29 $string['availableq'] = 'Available?';
1  mod/quiz/lang/en/quiz.php
@@ -70,7 +70,6 @@
70 70 $string['answers'] = 'Answers';
71 71 $string['answersingleno'] = 'Multiple answers allowed';
72 72 $string['answersingleyes'] = 'One answer only';
73   -$string['answerswithacceptederrormarginmustbenumeric'] = 'Answers with accepted error must be numeric';
74 73 $string['answertoolong'] = 'Answer too long after line {$a} (255 char. max)';
75 74 $string['aon'] = 'AON format';
76 75 $string['areyousureremoveselected'] = 'Are you sure you want to remove all the selected questions?';
4 question/type/calculated/lang/en/qtype_calculated.php
@@ -25,7 +25,6 @@
25 25
26 26 $string['additem'] = 'Add item';
27 27 $string['addmoreanswerblanks'] = 'Add another answer blank.';
28   -$string['addmoreunitblanks'] = 'Blanks for {$a} more units';
29 28 $string['addsets'] = 'Add set(s)';
30 29 $string['answerhdr'] = 'Answer';
31 30 $string['answerstoleranceparam'] = 'Answers tolerance parameters';
@@ -91,9 +90,7 @@
91 90 $string['missingformula'] = 'Missing formula';
92 91 $string['missingname'] = 'Missing question name';
93 92 $string['missingquestiontext'] = 'Missing question text';
94   -$string['mustbenumeric'] = '{$a} must be a number.';
95 93 $string['mustenteraformulaorstar'] = 'You must enter a formula or \'*\'.';
96   -$string['mustnotbenumeric'] = '{$a} can\'t be a number.';
97 94 $string['newcategory1'] = 'will use a new shared dataset';
98 95 $string['newcategory2'] = 'a file from a new set of files that may also be used by other questions in this category';
99 96 $string['newcategory3'] = 'a link from a new set of links that may also be used by other questions in this category';
@@ -142,7 +139,6 @@
142 139 $string['usedinquestion'] = 'Used in Question';
143 140 $string['youmustaddatleastoneitem'] = 'You must add at least one dataset item before you can save this question.';
144 141 $string['youmustaddatleastonevalue'] = 'You must add at least one set of wild card(s) values before you can save this question.';
145   -$string['youmustenteramultiplierhere'] = 'You must enter a multiplier here.';
146 142 $string['newsetwildcardvalues'] = 'new set(s) of wild card(s) values';
147 143 $string['setno'] = 'Set {$a}';
148 144 $string['setwildcardvalues'] = 'set(s) of wild card(s) values';
4 question/type/calculated/questiontype.php
@@ -366,8 +366,8 @@ public function validate_form($form) {
366 366 $form->tolerance[$key] = 0.0;
367 367 }
368 368 if (! is_numeric($form->tolerance[$key])) {
369   - $calculatedmessages[] = get_string(
370   - 'tolerancemustbenumeric', 'qtype_calculated');
  369 + $calculatedmessages[] = get_string('xmustbenumeric', 'qtype_numerical',
  370 + get_string('tolerance', 'qtype_calculated'));
371 371 }
372 372 }
373 373
2  question/type/calculatedmulti/edit_calculatedmulti_form.php
@@ -298,7 +298,7 @@ public function validation($data, $files) {
298 298 }
299 299 if (!is_numeric($data['tolerance'][$key])) {
300 300 $errors['tolerance['.$key.']'] =
301   - get_string('mustbenumeric', 'qtype_calculated',
  301 + get_string('xmustbenumeric', 'qtype_numerical',
302 302 get_string('acceptederror', 'qtype_numerical'));
303 303 }
304 304 if ($data['fraction'][$key] > 0) {
2  question/type/calculatedsimple/lang/en/qtype_calculatedsimple.php
@@ -27,8 +27,6 @@
27 27 $string['converttocalculated'] = 'Save as a new regular calculated question';
28 28 $string['findwildcards'] = 'Find the wild cards {x..} present in the correct answer formulas';
29 29 $string['generatenewitemsset'] = 'Generate';
30   -$string['mustbenumeric'] = 'You must enter a number here.';
31   -$string['mustnotbenumeric'] = 'This can\'t be a number.';
32 30 $string['newsetwildcardvalues'] = 'new set(s) of wild card(s) values';
33 31 $string['pluginname'] = 'Calculated simple';
34 32 $string['pluginname_help'] = 'Simple calculated questions enable individual numerical questions to be created using wildcards that are substituted with individual values when the quiz is taken. Simple calculated questions offer the most used features of the calculated question with a simpler creation interface.';
9 question/type/edit_question_form.php
@@ -337,7 +337,14 @@ protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
337 337
338 338 $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions,
339 339 'noanswers', 'addanswers', $addoptions,
340   - get_string('addmorechoiceblanks', 'qtype_multichoice'));
  340 + $this->get_more_choices_string());
  341 + }
  342 +
  343 + /**
  344 + * Language string to use for 'Add {no} more {whatever we call answers}'.
  345 + */
  346 + protected function get_more_choices_string() {
  347 + return get_string('addmorechoiceblanks', 'question');
341 348 }
342 349
343 350 protected function add_combined_feedback_fields($withshownumpartscorrect = false) {
1  question/type/multichoice/lang/en/qtype_multichoice.php
@@ -23,7 +23,6 @@
23 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 24 */
25 25
26   -$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
27 26 $string['answerhowmany'] = 'One or multiple answers?';
28 27 $string['answernumbering'] = 'Number the choices?';
29 28 $string['answernumbering123'] = '1., 2., 3., ...';
30 question/type/numerical/edit_numerical_form.php
@@ -63,6 +63,10 @@ protected function get_per_answer_fields($mform, $label, $gradeoptions,
63 63 return $repeated;
64 64 }
65 65
  66 + protected function get_more_choices_string() {
  67 + return get_string('addmoreanswerblanks', 'qtype_numerical');
  68 + }
  69 +
66 70 /**
67 71 * Add the unit handling options to the form.
68 72 * @param object $mform the form being built.
@@ -132,9 +136,8 @@ protected function add_unit_fields($mform) {
132 136 $mform->addElement('header', 'unithdr',
133 137 get_string('units', 'qtype_numerical'), '');
134 138
135   - $textboxgroup = array();
136   - $textboxgroup[] = $mform->createElement('group', 'units',
137   - get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false);
  139 + $unitfields = array($mform->createElement('group', 'units',
  140 + get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false));
138 141
139 142 $repeatedoptions['unit']['disabledif'] =
140 143 array('unitrole', 'eq', qtype_numerical::UNITNONE);
@@ -153,8 +156,8 @@ protected function add_unit_fields($mform) {
153 156 $repeatsatstart = $countunits;
154 157 }
155 158
156   - $this->repeat_elements($textboxgroup, $repeatsatstart, $repeatedoptions, 'nounits',
157   - 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'), true);
  159 + $this->repeat_elements($unitfields, $repeatsatstart, $repeatedoptions, 'nounits',
  160 + 'addunits', 2, get_string('addmoreunitblanks', 'qtype_numerical', '{no}'), true);
158 161
159 162 // The following strange-looking if statement is to do with when the
160 163 // form is used to move questions between categories. See MDL-15159.
@@ -173,6 +176,11 @@ protected function add_unit_fields($mform) {
173 176 }
174 177 }
175 178
  179 + /**
  180 + * Get the form fields needed to edit one unit.
  181 + * @param MoodleQuickForm $mform the form being built.
  182 + * @return array of form fields.
  183 + */
176 184 protected function unit_group($mform) {
177 185 $grouparray = array();
178 186 $grouparray[] = $mform->createElement('text', 'unit', get_string('unit', 'quiz'),
@@ -286,7 +294,7 @@ protected function validate_answers($data, $errors) {
286 294 }
287 295 if ($answer !== '*' && !is_numeric($data['tolerance'][$key])) {
288 296 $errors['tolerance['.$key.']'] =
289   - get_string('mustbenumeric', 'qtype_calculated',
  297 + get_string('xmustbenumeric', 'qtype_numerical',
290 298 get_string('acceptederror', 'qtype_numerical'));
291 299 }
292 300 } else if ($data['fraction'][$key] != 0 ||
@@ -356,8 +364,8 @@ protected function validate_numerical_options($data, $errors) {
356 364 foreach ($data['unit'] as $key => $unit) {
357 365 if (is_numeric($unit)) {
358 366 $errors['units[' . $key . ']'] =
359   - get_string('mustnotbenumeric', 'qtype_calculated',
360   - get_string('unit', 'quiz'));
  367 + get_string('xmustnotbenumeric', 'qtype_numerical',
  368 + get_string('unit', 'qtype_numerical'));
361 369 }
362 370
363 371 $trimmedunit = trim($unit);
@@ -368,11 +376,11 @@ protected function validate_numerical_options($data, $errors) {
368 376 $trimmedmultiplier = trim($data['multiplier'][$key]);
369 377 if (empty($trimmedmultiplier)) {
370 378 $errors['units[' . $key . ']'] =
371   - get_string('youmustenteramultiplierhere', 'qtype_calculated');
  379 + get_string('youmustenteramultiplierhere', 'qtype_numerical');
372 380 } else if (!is_numeric($trimmedmultiplier)) {
373 381 $errors['units[' . $key . ']'] =
374   - get_string('mustbenumeric', 'qtype_calculated',
375   - get_string('multiplier', 'quiz'));
  382 + get_string('xmustbenumeric', 'qtype_numerical',
  383 + get_string('multiplier', 'qtype_numerical'));
376 384 }
377 385 }
378 386
7 question/type/numerical/lang/en/qtype_numerical.php
@@ -24,8 +24,8 @@
24 24 */
25 25
26 26 $string['acceptederror'] = 'Accepted error';
27   -$string['addmoreanswerblanks'] = 'Blanks for {no} More Answers';
28   -$string['addmoreunitblanks'] = 'Blanks for {no} More Units';
  27 +$string['addmoreanswerblanks'] = 'Blanks for {no} more answers';
  28 +$string['addmoreunitblanks'] = 'Blanks for {no} more units';
29 29 $string['answercolon'] = 'Answer:';
30 30 $string['answermustbenumberorstar'] = 'The answer must be a number, for example -1.234 or 3e8, or \'*\'.';
31 31 $string['answerno'] = 'Answer {$a}';
@@ -115,3 +115,6 @@
115 115 1.350067 E4 : 1.350067 E04 ';
116 116
117 117 $string['validnumbers'] = '13500.67, 13 500.67, 13,500.67, 13500,67, 13 500,67, 1.350067 E4 or 1.350067 E04';
  118 +$string['xmustbenumeric'] = '{$a} must be a number.';
  119 +$string['xmustnotbenumeric'] = '{$a} cannot be a number.';
  120 +$string['youmustenteramultiplierhere'] = 'You must enter a multiplier here.';
4 question/type/shortanswer/edit_shortanswer_form.php
@@ -54,6 +54,10 @@ protected function definition_inner($mform) {
54 54 $this->add_interactive_settings();
55 55 }
56 56
  57 + protected function get_more_choices_string() {
  58 + return get_string('addmoreanswerblanks', 'qtype_shortanswer');
  59 + }
  60 +
57 61 protected function data_preprocessing($question) {
58 62 $question = parent::data_preprocessing($question);
59 63 $question = $this->data_preprocessing_answers($question);

0 comments on commit 5574862

Please sign in to comment.
Something went wrong with that request. Please try again.