From 7e9b889e30456118080a5c3f6443c0555468b427 Mon Sep 17 00:00:00 2001 From: iPegii <51372604+iPegii@users.noreply.github.com> Date: Thu, 17 Feb 2022 13:37:46 +0200 Subject: [PATCH] Add translated labels to aria-label --- .../src/components/ClickableMultipleChoice.tsx | 9 +++++++-- .../moocfi-quizzes/src/components/MultipleChoice.tsx | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/moocfi-quizzes/src/components/ClickableMultipleChoice.tsx b/packages/moocfi-quizzes/src/components/ClickableMultipleChoice.tsx index 4b527488..abeee827 100644 --- a/packages/moocfi-quizzes/src/components/ClickableMultipleChoice.tsx +++ b/packages/moocfi-quizzes/src/components/ClickableMultipleChoice.tsx @@ -250,6 +250,7 @@ const Option: React.FunctionComponent = ({ // should be impossible return
Cannot find related item or language
} + const generalLabels = languageLabels.general const itemAnswer = quizAnswer.itemAnswers.find( ia => ia.quizItemId === item.id, ) @@ -322,7 +323,9 @@ const Option: React.FunctionComponent = ({ {...clickOptions} aria-selected={optionIsSelected} aria-label={`${text.title}-${ - option.correct ? "correct" : "incorrect" + option.correct + ? generalLabels.answerCorrectLabel + : generalLabels.answerIncorrectLabel }`} > @@ -348,7 +351,9 @@ const Option: React.FunctionComponent = ({ {...clickOptions} aria-selected={optionIsSelected} aria-label={`${text.title}-${ - option.correct ? "correct" : "incorrect" + option.correct + ? generalLabels.answerCorrectLabel + : generalLabels.answerIncorrectLabel }`} > diff --git a/packages/moocfi-quizzes/src/components/MultipleChoice.tsx b/packages/moocfi-quizzes/src/components/MultipleChoice.tsx index 74c983c0..f575d1f4 100644 --- a/packages/moocfi-quizzes/src/components/MultipleChoice.tsx +++ b/packages/moocfi-quizzes/src/components/MultipleChoice.tsx @@ -288,6 +288,7 @@ const Option: React.FunctionComponent = ({ // should be impossible return
Cannot find related item or language
} + const generalLabels = languageLabels.general const itemAnswer = quizAnswer.itemAnswers.find( ia => ia.quizItemId === item.id, ) @@ -351,7 +352,9 @@ const Option: React.FunctionComponent = ({ {...clickOptions} aria-selected={optionIsSelected} aria-label={`${text.title}-${ - option.correct ? "correct" : "incorrect" + option.correct + ? generalLabels.answerCorrectLabel + : generalLabels.answerIncorrectLabel }`} > @@ -385,7 +388,9 @@ const Option: React.FunctionComponent = ({ {...clickOptions} aria-selected={optionIsSelected} aria-label={`${text.title}-${ - option.correct ? "correct" : "incorrect" + option.correct + ? generalLabels.answerCorrectLabel + : generalLabels.answerIncorrectLabel }`} >