diff --git a/app/classifier/tasks/survey/summary.jsx b/app/classifier/tasks/survey/summary.jsx index b5465948ab..8f3ba9455d 100644 --- a/app/classifier/tasks/survey/summary.jsx +++ b/app/classifier/tasks/survey/summary.jsx @@ -1,6 +1,6 @@ import React from 'react'; import Translate from 'react-translate-component'; -import Utility from './utility'; +import translations from '../../../pages/project/translations'; class SurveySummary extends React.Component { constructor(props) { @@ -16,16 +16,16 @@ class SurveySummary extends React.Component { render() { const { task, annotation } = this.props; + const taskStrings = translations.strings.workflow.tasks; const choiceSummaries = annotation.value.map((identification) => { - const choice = task.choices[identification.choice]; - const questionIds = Utility.getQuestionIDs(task, identification.choice); - const filteredQuestionIds = questionIds.filter(questionId => Object.keys(identification.answers).indexOf(questionId) > -1); - const allAnswers = filteredQuestionIds.map(questionId => - [].concat(identification.answers[questionId]) - .map(answerId => task.questions[questionId].answers[answerId].label) - .join(', ') - ); - return `${choice.label}: ${allAnswers.join('; ')}`; + const translationChoiceKey = `${annotation.task}.choices.${identification.choice}.label`; + const allAnswers = Object.keys(identification.answers).map((questionId) => { + const translationQuestionKey = `${annotation.task}.questions.${questionId}`; + const answerKeys = [].concat(identification.answers[questionId]); + const answers = answerKeys.map(answerId => taskStrings[`${translationQuestionKey}.answers.${answerId}.label`]); + return answers.join(', '); + }); + return `${taskStrings[translationChoiceKey]}: ${allAnswers.join('; ')}`; }); return (