This module enables the generation of localized questionnaires by substituting user-defined data into HTML templates. The templates can be localized to support the use of questionnaires in different regions and languages. Users can customize the questionnaire text to match their preferred language and cultural context by modifying two JSON localization files.
The questionnaires are structured around two main types, each associated with its own JSON localization file:
localization/type1_localization.json
for the QType1.localization/type2_localization.json
for the QType2.
These JSON files allow for the customization of titles, questions, answers, and error messages.
-
Prepare the Localization Files:
- The user should edit the provided
type1_localization.json
andtype2_localization.json
files to localize the text content of the questionnaires. - Each field in the JSON file corresponds to a specific text element displayed in the questionnaire.
- The user should edit the provided
-
Substitute Data in HTML Templates:
- The content from the JSON files is injected into HTML templates, ensuring that the questionnaire is appropriately localized.
Here is an example of how to define the localization content for a questionnaire of type 1:
{
"title": "Question",
"description": "",
"question_explanation": "Please choose the option you agree with the most about the displayed fundus image.",
"positive_answer": "This image displays the signs of background",
"negative_answer": "I believe that this image does not show any of the listed conditions.",
"unclear_image_answer": "The image is not good enough for assessing the diagnosis.",
"certainty_question": "How certain are you in your response?",
"min_certain": "Uncertain",
"max_certain": "Certain",
"error_text": "Please answer the question.",
"thank_you_message": "Thank you for completing the questionnaire!",
"localization": "en"
}
- title: The title displayed at the beginning of each question.
- description: An optional description for the question (can be left empty).
- question_explanation: A prompt explaining what the user should do for each question.
- positive_answer: The text shown for a positive response to the question.
- negative_answer: The text shown for a negative response to the question.
- unclear_image_answer: A message indicating that the image is of insufficient quality for diagnosis.
- certainty_question: A question prompting the user to indicate their confidence level in their response.
- min_certain: Label for the minimum confidence level (e.g., "Uncertain").
- max_certain: Label for the maximum confidence level (e.g., "Certain").
- error_text: An error message displayed when the user fails to answer a question.
- thank_you_message: A message displayed upon completion of the questionnaire.
- localization: The language code used for localization (e.g., "en" for English).
{
"original_title": "Original picture",
"answer_choice_title": "Segmentation maps",
"error_text": "Please choose one of the two segmentation maps.",
"localization": "en"
}
- original_title: The title for the original/reference image that is being displayed to the observer. This label helps observer identify the reference image they are evaluating.
- answer_choice_title: The title that precedes the images. This label guides the observer in understanding what they are expected to select.
- error_text: The message displayed when the observer fails to select one of the compared images.
- localization: The language code indicating the localization of the text within the JSON file. For instance, "en" signifies that the content is in English.
- Open the
type1_localization.json
andtype2_localization.json
files in a text editor. - Modify the text fields to match the desired language.
- Save the changes and regenerate the questionnaires using the provided tool. The content will be automatically substituted into the HTML templates.
Notes:
- Ensure you use proper encoding when editing JSON files to avoid issues with special characters.
- If needed, create multiple localization files for different languages and load the appropriate one based on the user's region.