Commit ca93855f by polesye

BLD-717: MultipleChoiceResponse i18n.

parent b44ed806
...@@ -843,7 +843,10 @@ class MultipleChoiceResponse(LoncapaResponse): ...@@ -843,7 +843,10 @@ class MultipleChoiceResponse(LoncapaResponse):
Fails with LoncapaProblemError if called on a response that is not masking. Fails with LoncapaProblemError if called on a response that is not masking.
""" """
if not self.has_mask(): if not self.has_mask():
raise LoncapaProblemError("unmask_name called on response that is not masked") _ = self.capa_system.i18n.ugettext
# Translators: 'unmask_name' is a method name and should not be translated.
msg = _("unmask_name called on response that is not masked")
raise LoncapaProblemError(msg)
return self._mask_dict[name] return self._mask_dict[name]
def unmask_order(self): def unmask_order(self):
...@@ -870,7 +873,10 @@ class MultipleChoiceResponse(LoncapaResponse): ...@@ -870,7 +873,10 @@ class MultipleChoiceResponse(LoncapaResponse):
if choicegroups: if choicegroups:
choicegroup = choicegroups[0] choicegroup = choicegroups[0]
if choicegroup.get('answer-pool') is not None: if choicegroup.get('answer-pool') is not None:
raise LoncapaProblemError("Do not use shuffle and answer-pool at the same time") _ = self.capa_system.i18n.ugettext
# Translators: 'shuffle' and 'answer-pool' are attribute names and should not be translated.
msg = _("Do not use shuffle and answer-pool at the same time")
raise LoncapaProblemError(msg)
# Note in the response that shuffling is done. # Note in the response that shuffling is done.
# Both to avoid double-processing, and to feed the logs. # Both to avoid double-processing, and to feed the logs.
if self.has_shuffle(): if self.has_shuffle():
...@@ -950,7 +956,10 @@ class MultipleChoiceResponse(LoncapaResponse): ...@@ -950,7 +956,10 @@ class MultipleChoiceResponse(LoncapaResponse):
try: try:
num_choices = int(num_str) num_choices = int(num_str)
except ValueError: except ValueError:
raise LoncapaProblemError("answer-pool value should be an integer") _ = self.capa_system.i18n.ugettext
# Translators: 'answer-pool' is an attribute name and should not be translated.
msg = _("answer-pool value should be an integer")
raise LoncapaProblemError(msg)
# Note in the response that answerpool is done. # Note in the response that answerpool is done.
# Both to avoid double-processing, and to feed the logs. # Both to avoid double-processing, and to feed the logs.
...@@ -1014,7 +1023,10 @@ class MultipleChoiceResponse(LoncapaResponse): ...@@ -1014,7 +1023,10 @@ class MultipleChoiceResponse(LoncapaResponse):
# Or perhaps in the overall author workflow, these errors are unhelpful and # Or perhaps in the overall author workflow, these errors are unhelpful and
# should all be removed. # should all be removed.
if len(correct_choices) < 1 or len(incorrect_choices) < 1: if len(correct_choices) < 1 or len(incorrect_choices) < 1:
raise LoncapaProblemError("Choicegroup must include at least 1 correct and 1 incorrect choice") _ = self.capa_system.i18n.ugettext
# Translators: 'Choicegroup' is an input type and should not be translated.
msg = _("Choicegroup must include at least 1 correct and 1 incorrect choice")
raise LoncapaProblemError(msg)
# Limit the number of incorrect choices to what we actually have # Limit the number of incorrect choices to what we actually have
num_incorrect = num_pool - 1 num_incorrect = num_pool - 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment