Commit 581716cb by Anton Stupak

Merge pull request #3414 from edx/anton/i18n-choice-response

MultipleChoiceResponse i18n.
parents b44ed806 ca93855f
......@@ -843,7 +843,10 @@ class MultipleChoiceResponse(LoncapaResponse):
Fails with LoncapaProblemError if called on a response that is not masking.
"""
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]
def unmask_order(self):
......@@ -870,7 +873,10 @@ class MultipleChoiceResponse(LoncapaResponse):
if choicegroups:
choicegroup = choicegroups[0]
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.
# Both to avoid double-processing, and to feed the logs.
if self.has_shuffle():
......@@ -950,7 +956,10 @@ class MultipleChoiceResponse(LoncapaResponse):
try:
num_choices = int(num_str)
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.
# Both to avoid double-processing, and to feed the logs.
......@@ -1014,7 +1023,10 @@ class MultipleChoiceResponse(LoncapaResponse):
# Or perhaps in the overall author workflow, these errors are unhelpful and
# should all be removed.
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
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