Permalink
Browse files

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...
timhunt committed Jan 11, 2013
1 parent c4b2600 commit 5574862063699039658f0a28449ac911244794d2
View
@@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
$string['addcategory'] = 'Add category';
$string['adminreport'] = 'Report on possible problems in your question database.';
$string['availableq'] = 'Available?';
@@ -70,7 +70,6 @@
$string['answers'] = 'Answers';
$string['answersingleno'] = 'Multiple answers allowed';
$string['answersingleyes'] = 'One answer only';
-$string['answerswithacceptederrormarginmustbenumeric'] = 'Answers with accepted error must be numeric';
$string['answertoolong'] = 'Answer too long after line {$a} (255 char. max)';
$string['aon'] = 'AON format';
$string['areyousureremoveselected'] = 'Are you sure you want to remove all the selected questions?';
@@ -25,7 +25,6 @@
$string['additem'] = 'Add item';
$string['addmoreanswerblanks'] = 'Add another answer blank.';
-$string['addmoreunitblanks'] = 'Blanks for {$a} more units';
$string['addsets'] = 'Add set(s)';
$string['answerhdr'] = 'Answer';
$string['answerstoleranceparam'] = 'Answers tolerance parameters';
@@ -91,9 +90,7 @@
$string['missingformula'] = 'Missing formula';
$string['missingname'] = 'Missing question name';
$string['missingquestiontext'] = 'Missing question text';
-$string['mustbenumeric'] = '{$a} must be a number.';
$string['mustenteraformulaorstar'] = 'You must enter a formula or \'*\'.';
-$string['mustnotbenumeric'] = '{$a} can\'t be a number.';
$string['newcategory1'] = 'will use a new shared dataset';
$string['newcategory2'] = 'a file from a new set of files that may also be used by other questions in this category';
$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 @@
$string['usedinquestion'] = 'Used in Question';
$string['youmustaddatleastoneitem'] = 'You must add at least one dataset item before you can save this question.';
$string['youmustaddatleastonevalue'] = 'You must add at least one set of wild card(s) values before you can save this question.';
-$string['youmustenteramultiplierhere'] = 'You must enter a multiplier here.';
$string['newsetwildcardvalues'] = 'new set(s) of wild card(s) values';
$string['setno'] = 'Set {$a}';
$string['setwildcardvalues'] = 'set(s) of wild card(s) values';
@@ -366,8 +366,8 @@ public function validate_form($form) {
$form->tolerance[$key] = 0.0;
}
if (! is_numeric($form->tolerance[$key])) {
- $calculatedmessages[] = get_string(
- 'tolerancemustbenumeric', 'qtype_calculated');
+ $calculatedmessages[] = get_string('xmustbenumeric', 'qtype_numerical',
+ get_string('tolerance', 'qtype_calculated'));
}
}
@@ -298,7 +298,7 @@ public function validation($data, $files) {
}
if (!is_numeric($data['tolerance'][$key])) {
$errors['tolerance['.$key.']'] =
- get_string('mustbenumeric', 'qtype_calculated',
+ get_string('xmustbenumeric', 'qtype_numerical',
get_string('acceptederror', 'qtype_numerical'));
}
if ($data['fraction'][$key] > 0) {
@@ -27,8 +27,6 @@
$string['converttocalculated'] = 'Save as a new regular calculated question';
$string['findwildcards'] = 'Find the wild cards {x..} present in the correct answer formulas';
$string['generatenewitemsset'] = 'Generate';
-$string['mustbenumeric'] = 'You must enter a number here.';
-$string['mustnotbenumeric'] = 'This can\'t be a number.';
$string['newsetwildcardvalues'] = 'new set(s) of wild card(s) values';
$string['pluginname'] = 'Calculated simple';
$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.';
@@ -337,7 +337,14 @@ protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
$this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions,
'noanswers', 'addanswers', $addoptions,
- get_string('addmorechoiceblanks', 'qtype_multichoice'));
+ $this->get_more_choices_string());
+ }
+
+ /**
+ * Language string to use for 'Add {no} more {whatever we call answers}'.
+ */
+ protected function get_more_choices_string() {
+ return get_string('addmorechoiceblanks', 'question');
}
protected function add_combined_feedback_fields($withshownumpartscorrect = false) {
@@ -23,7 +23,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
$string['answerhowmany'] = 'One or multiple answers?';
$string['answernumbering'] = 'Number the choices?';
$string['answernumbering123'] = '1., 2., 3., ...';
@@ -63,6 +63,10 @@ protected function get_per_answer_fields($mform, $label, $gradeoptions,
return $repeated;
}
+ protected function get_more_choices_string() {
+ return get_string('addmoreanswerblanks', 'qtype_numerical');
+ }
+
/**
* Add the unit handling options to the form.
* @param object $mform the form being built.
@@ -132,9 +136,8 @@ protected function add_unit_fields($mform) {
$mform->addElement('header', 'unithdr',
get_string('units', 'qtype_numerical'), '');
- $textboxgroup = array();
- $textboxgroup[] = $mform->createElement('group', 'units',
- get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false);
+ $unitfields = array($mform->createElement('group', 'units',
+ get_string('unitx', 'qtype_numerical'), $this->unit_group($mform), null, false));
$repeatedoptions['unit']['disabledif'] =
array('unitrole', 'eq', qtype_numerical::UNITNONE);
@@ -153,8 +156,8 @@ protected function add_unit_fields($mform) {
$repeatsatstart = $countunits;
}
- $this->repeat_elements($textboxgroup, $repeatsatstart, $repeatedoptions, 'nounits',
- 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'), true);
+ $this->repeat_elements($unitfields, $repeatsatstart, $repeatedoptions, 'nounits',
+ 'addunits', 2, get_string('addmoreunitblanks', 'qtype_numerical', '{no}'), true);
// The following strange-looking if statement is to do with when the
// form is used to move questions between categories. See MDL-15159.
@@ -173,6 +176,11 @@ protected function add_unit_fields($mform) {
}
}
+ /**
+ * Get the form fields needed to edit one unit.
+ * @param MoodleQuickForm $mform the form being built.
+ * @return array of form fields.
+ */
protected function unit_group($mform) {
$grouparray = array();
$grouparray[] = $mform->createElement('text', 'unit', get_string('unit', 'quiz'),
@@ -286,7 +294,7 @@ protected function validate_answers($data, $errors) {
}
if ($answer !== '*' && !is_numeric($data['tolerance'][$key])) {
$errors['tolerance['.$key.']'] =
- get_string('mustbenumeric', 'qtype_calculated',
+ get_string('xmustbenumeric', 'qtype_numerical',
get_string('acceptederror', 'qtype_numerical'));
}
} else if ($data['fraction'][$key] != 0 ||
@@ -356,8 +364,8 @@ protected function validate_numerical_options($data, $errors) {
foreach ($data['unit'] as $key => $unit) {
if (is_numeric($unit)) {
$errors['units[' . $key . ']'] =
- get_string('mustnotbenumeric', 'qtype_calculated',
- get_string('unit', 'quiz'));
+ get_string('xmustnotbenumeric', 'qtype_numerical',
+ get_string('unit', 'qtype_numerical'));
}
$trimmedunit = trim($unit);
@@ -368,11 +376,11 @@ protected function validate_numerical_options($data, $errors) {
$trimmedmultiplier = trim($data['multiplier'][$key]);
if (empty($trimmedmultiplier)) {
$errors['units[' . $key . ']'] =
- get_string('youmustenteramultiplierhere', 'qtype_calculated');
+ get_string('youmustenteramultiplierhere', 'qtype_numerical');
} else if (!is_numeric($trimmedmultiplier)) {
$errors['units[' . $key . ']'] =
- get_string('mustbenumeric', 'qtype_calculated',
- get_string('multiplier', 'quiz'));
+ get_string('xmustbenumeric', 'qtype_numerical',
+ get_string('multiplier', 'qtype_numerical'));
}
}
@@ -24,8 +24,8 @@
*/
$string['acceptederror'] = 'Accepted error';
-$string['addmoreanswerblanks'] = 'Blanks for {no} More Answers';
-$string['addmoreunitblanks'] = 'Blanks for {no} More Units';
+$string['addmoreanswerblanks'] = 'Blanks for {no} more answers';
+$string['addmoreunitblanks'] = 'Blanks for {no} more units';
$string['answercolon'] = 'Answer:';
$string['answermustbenumberorstar'] = 'The answer must be a number, for example -1.234 or 3e8, or \'*\'.';
$string['answerno'] = 'Answer {$a}';
@@ -115,3 +115,6 @@
1.350067 E4 : 1.350067 E04 ';
$string['validnumbers'] = '13500.67, 13 500.67, 13,500.67, 13500,67, 13 500,67, 1.350067 E4 or 1.350067 E04';
+$string['xmustbenumeric'] = '{$a} must be a number.';
+$string['xmustnotbenumeric'] = '{$a} cannot be a number.';
+$string['youmustenteramultiplierhere'] = 'You must enter a multiplier here.';
@@ -54,6 +54,10 @@ protected function definition_inner($mform) {
$this->add_interactive_settings();
}
+ protected function get_more_choices_string() {
+ return get_string('addmoreanswerblanks', 'qtype_shortanswer');
+ }
+
protected function data_preprocessing($question) {
$question = parent::data_preprocessing($question);
$question = $this->data_preprocessing_answers($question);

0 comments on commit 5574862

Please sign in to comment.