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
This commit is contained in:
Tim Hunt 2013-01-11 17:12:12 +00:00
parent c4b2600d4b
commit 5574862063
11 changed files with 40 additions and 25 deletions

View File

@ -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?';

View File

@ -70,7 +70,6 @@ $string['answerhowmany'] = 'One or multiple answers?';
$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?';

View File

@ -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['minmax'] = 'Range of Values';
$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['updatetolerancesparam'] = 'Update the answers tolerance parameters';
$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';

View File

@ -366,8 +366,8 @@ class qtype_calculated extends question_type {
$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'));
}
}

View File

@ -298,7 +298,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
}
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) {

View File

@ -27,8 +27,6 @@ $string['atleastonewildcard'] = 'There must be at least one wild card <strong>{x
$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.';

View File

@ -337,7 +337,14 @@ abstract class question_edit_form extends question_wizard_form {
$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) {

View File

@ -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., ...';

View File

@ -63,6 +63,10 @@ class qtype_numerical_edit_form extends question_edit_form {
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 @@ class qtype_numerical_edit_form extends question_edit_form {
$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 @@ class qtype_numerical_edit_form extends question_edit_form {
$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 @@ class qtype_numerical_edit_form extends question_edit_form {
}
}
/**
* 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 @@ class qtype_numerical_edit_form extends question_edit_form {
}
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 @@ class qtype_numerical_edit_form extends question_edit_form {
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 @@ class qtype_numerical_edit_form extends question_edit_form {
$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'));
}
}

View File

@ -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 @@ $string['validnumberformats_help'] = '
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.';

View File

@ -54,6 +54,10 @@ class qtype_shortanswer_edit_form extends question_edit_form {
$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);