-
Notifications
You must be signed in to change notification settings - Fork 146
fix: translation on select problem type #1798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; | |
import { | ||
AdvancedProblemType, | ||
AdvanceProblems, | ||
AdvanceProblemsStatus, | ||
ProblemType, | ||
ProblemTypeKeys, | ||
} from '../../../../../data/constants/problem'; | ||
|
@@ -54,25 +55,29 @@ const AdvanceTypeSelect: React.FC<Props> = ({ | |
className="px-4" | ||
> | ||
{Object.entries(AdvanceProblems).map(([type, data]) => { | ||
if (data.status !== '') { | ||
if (data.status !== AdvanceProblemsStatus.empty) { | ||
return ( | ||
<ActionRow className="border-primary-100 border-bottom m-0 py-3 w-100" key={type}> | ||
<Form.Radio id={type} value={type}> | ||
{intl.formatMessage(messages.advanceProblemTypeLabel, { problemType: data.title })} | ||
{intl.formatMessage(messages.advanceProblemTypeLabel, { | ||
problemType: intl.formatMessage(data.titleMessage), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea of |
||
})} | ||
</Form.Radio> | ||
<ActionRow.Spacer /> | ||
<OverlayTrigger | ||
placement="right" | ||
overlay={( | ||
<Tooltip id={`tooltip-adv-${type}`}> | ||
<div className="text-left"> | ||
{intl.formatMessage(messages.supportStatusTooltipMessage, { supportStatus: data.status.replace(' ', '_') })} | ||
{intl.formatMessage(messages.supportStatusTooltipMessage, { supportStatus: data.status.defaultMessage.replace(' ', '_') })} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this using the default message instead of an internationalized version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of the When I add the translation to pt-pt locale on "authoring.problemEditor.advanceProblem.supportStatus.tooltipMessage": "{supportStatus, select, Provisional {As ferramentas suportadas provisoriamente podem não ter a robustez de funcionalidade que os seus cursos exigem. O edX não tem controlo sobre a qualidade do software ou do conteúdo que pode ser fornecido utilizando estas ferramentas. Teste estas ferramentas cuidadosamente antes de as utilizar no seu curso, especialmente em secções com classificação. A documentação completa pode não estar disponível para as ferramentas suportadas provisoriamente, ou a documentação pode estar disponível a partir de outras fontes que não a edX.} Not_supported {As ferramentas sem suporte não são mantidas pela edX e podem ser descontinuadas no futuro. Não são recomendadas para utilização em cursos devido à não conformidade com um ou mais dos requisitos básicos, tais como testes, acessibilidade, internacionalização e documentação.} other { } }", It shows correctly has: |
||
</div> | ||
</Tooltip> | ||
)} | ||
> | ||
<div className="text-gray-500"> | ||
{intl.formatMessage(messages.problemSupportStatus, { supportStatus: data.status })} | ||
{intl.formatMessage(messages.problemSupportStatus, { | ||
supportStatus: intl.formatMessage(data.status), | ||
})} | ||
</div> | ||
</OverlayTrigger> | ||
</ActionRow> | ||
|
@@ -81,7 +86,9 @@ const AdvanceTypeSelect: React.FC<Props> = ({ | |
return ( | ||
<ActionRow className="border-primary-100 border-bottom m-0 py-3 w-100" key={type}> | ||
<Form.Radio id={type} value={type}> | ||
{intl.formatMessage(messages.advanceProblemTypeLabel, { problemType: data.title })} | ||
{intl.formatMessage(messages.advanceProblemTypeLabel, { | ||
problemType: intl.formatMessage(data.titleMessage), | ||
})} | ||
</Form.Radio> | ||
<ActionRow.Spacer /> | ||
</ActionRow> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
import { ProblemTypeKeys, AdvanceProblemKeys } from './problemTypes'; | ||
|
||
export const ProblemTypesTitleMessages = defineMessages({ | ||
[ProblemTypeKeys.SINGLESELECT]: { | ||
id: 'authoring.problemeditor.problemtype.title.singleselect', | ||
defaultMessage: 'Single select', | ||
}, | ||
[ProblemTypeKeys.MULTISELECT]: { | ||
id: 'authoring.problemeditor.problemtype.title.multiSelect', | ||
defaultMessage: 'Multi-select', | ||
}, | ||
[ProblemTypeKeys.DROPDOWN]: { | ||
id: 'authoring.problemeditor.problemtype.title.dropdown', | ||
defaultMessage: 'Dropdown', | ||
}, | ||
[ProblemTypeKeys.NUMERIC]: { | ||
id: 'authoring.problemeditor.problemtype.title.numeric', | ||
defaultMessage: 'Numerical input', | ||
}, | ||
[ProblemTypeKeys.TEXTINPUT]: { | ||
id: 'authoring.problemeditor.problemtype.title.textInput', | ||
defaultMessage: 'Text input', | ||
}, | ||
[ProblemTypeKeys.ADVANCED]: { | ||
id: 'authoring.problemeditor.problemtype.title.advanced', | ||
defaultMessage: 'Advanced Problem', | ||
}, | ||
}); | ||
|
||
export const ProblemTypesPreviewDescription = defineMessages({ | ||
[ProblemTypeKeys.SINGLESELECT]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.singleselect', | ||
defaultMessage: 'Learners must select the correct answer from a list of possible options.', | ||
}, | ||
[ProblemTypeKeys.MULTISELECT]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.multiselect', | ||
defaultMessage: 'Learners must select all correct answers from a list of possible options.', | ||
}, | ||
[ProblemTypeKeys.DROPDOWN]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.dropdown', | ||
defaultMessage: 'Learners must select the correct answer from a list of possible options', | ||
}, | ||
[ProblemTypeKeys.NUMERIC]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.numeric', | ||
defaultMessage: 'Specify one or more correct numeric answers, submitted in a response field.', | ||
}, | ||
[ProblemTypeKeys.TEXTINPUT]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.textinput', | ||
defaultMessage: 'Specify one or more correct text answers, including numbers and special characters, submitted in a response field.', | ||
}, | ||
[ProblemTypeKeys.ADVANCED]: { | ||
id: 'authoring.problemeditor.problemtype.previewDescription.advanced', | ||
defaultMessage: 'Specify an advanced problem.', | ||
}, | ||
}); | ||
|
||
export const ProblemTypesDescription = defineMessages({ | ||
[ProblemTypeKeys.SINGLESELECT]: { | ||
id: 'authoring.problemeditor.problemtype.description.singleselect', | ||
defaultMessage: 'Enter your single select answers below and select which choices are correct. Learners must choose one correct answer.', | ||
}, | ||
[ProblemTypeKeys.MULTISELECT]: { | ||
id: 'authoring.problemeditor.problemtype.description.multiselect', | ||
defaultMessage: 'Enter your multi select answers below and select which choices are correct. Learners must choose all correct answers.', | ||
}, | ||
[ProblemTypeKeys.DROPDOWN]: { | ||
id: 'authoring.problemeditor.problemtype.description.dropdown', | ||
defaultMessage: 'Enter your dropdown answers below and select which choice is correct. Learners must select one correct answer.', | ||
}, | ||
[ProblemTypeKeys.NUMERIC]: { | ||
id: 'authoring.problemeditor.problemtype.description.numeric', | ||
defaultMessage: 'Enter correct numerical input answers below. Learners must enter one correct answer.', | ||
}, | ||
[ProblemTypeKeys.TEXTINPUT]: { | ||
id: 'authoring.problemeditor.problemtype.description.textinput', | ||
defaultMessage: 'Enter your text input answers below and select which choices are correct. Learners must enter one correct answer.', | ||
}, | ||
[ProblemTypeKeys.ADVANCED]: { | ||
id: 'authoring.problemeditor.problemtype.description.advanced', | ||
defaultMessage: 'An Advanced Problem Type.', | ||
}, | ||
}); | ||
|
||
export const AdvanceProblemsTitleMessages = defineMessages({ | ||
[AdvanceProblemKeys.BLANK]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.blank', | ||
defaultMessage: 'Blank problem', | ||
}, | ||
[AdvanceProblemKeys.CIRCUITSCHEMATIC]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.circuitSchematic', | ||
defaultMessage: 'Circuit schematic builder', | ||
}, | ||
[AdvanceProblemKeys.JSINPUT]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.jsInput', | ||
defaultMessage: 'Custom JavaScript display and grading', | ||
}, | ||
[AdvanceProblemKeys.CUSTOMGRADER]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.customGrader', | ||
defaultMessage: 'Custom Python-evaluated input', | ||
}, | ||
[AdvanceProblemKeys.IMAGE]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.image', | ||
defaultMessage: 'Image mapped input', | ||
}, | ||
[AdvanceProblemKeys.FORMULA]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.formula', | ||
defaultMessage: 'Math expression input', | ||
}, | ||
[AdvanceProblemKeys.PROBLEMWITHHINT]: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.problemWithHint', | ||
defaultMessage: 'Problem with adaptive hint', | ||
}, | ||
}); | ||
|
||
export const AdvanceProblemsStatus = defineMessages({ | ||
empty: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.status.empty', | ||
defaultMessage: '', | ||
}, | ||
notSupported: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.status.notSupported', | ||
defaultMessage: 'Not supported', | ||
}, | ||
provisional: { | ||
id: 'authoring.problemeditor.settings.advanceProblems.status.provisional', | ||
defaultMessage: 'Provisional', | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels odd to me for a couple reasons:
intl
here, so wouldn't this end up checking for the object instead of the string?I'd think sticking to
''
would be simpler and continue to work. Did you run into something that made that not work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it is kind of strange, but the
status
ofAdvanceProblems
is now aAdvanceProblemsStatus
.