Form Builder Internationalization

Hi All,

Internationalization for Form Builder contains of two parts:

  1. Internationalizing the forms which are built using form builder
  2. Internationalizing the form builder app

We are mainly focusing on internationalizing the forms built using form builder. Currently Form-Builder is only supported in English.

The following things needs to be considered for i18n a. Static Labels, Section Labels b. Concepts, Concept-sets, Coded Conceps, Concept set members

We thought of a solution and the approach is that

During the Design time:

  1. All concepts and labels are assumed to be set in “Default Locale”.
  2. Concept search will be for default locale.
  3. Generate keys for all the static Labels and Concepts with their default values. We are considering the keys to be in the following formats a. For Labels: 'LABEL_ID' b. For Concepts: 'CONCEPT_NAME_ID' The ID in the above keys will be the control IDs
  4. The generated keys will be stored as part of the control in the form JSON.
  5. After the initial design of the form, there will be an option for “language settings” in Form Builder app. a. User selects a language (different from the default locale) and the translations are generated for the form for the selected locale. b. All the translations for a form can be stored in a one JSON file per locale in "/bahmni_config/openmrs/app/forms/translations/" location. c. For “Concepts” associated with the form, We can just have an API exposed on the server, which provides the translations for all concepts in the form, concept members, concept answers. d. For Static Labels/ Section Labels, we can store the default values in the JSON and the user/implementer can update the values
  6. The generated translation file will be of the following format. There will be one translation file per locale. It will consists of translations of labels, concepts of all the forms with form-name as key and the translations as value.
{
  "form-1": {
    "Labels": {
      "LABEL_2": "Follow Up"
    },
    "Concepts": {
      "TEMPERATURE_5": "Temperature"
    }
  },
  "form-2": {
    "Labels": {
      "LABEL_5": "Adverse Events"
    },
    "Concepts": {
      "PULSE_2": "Pulse"
    }
  }
}

7.We will have a small app(UI app) to let the users/implementer to update the translations for any form within the form builder app.

During the Run time:

  1. When a published form is rendered on Bahmni a. an API call is made to fetch the translations for the form for loggedin locale and passed to the form. b. Form is rendered with corresponding translations.

Extensions:

  1. Instead of the form-builder app generating the translations, we can store an API like "/openmrs/form-controls/translations?locale=fr&formName=abc" which can be configured to generate the translations in the above format. Users/implementers can configure a custom URL to fetch the translations.

Form Events:

  1. Form level events, control level events - may have effect on API form.getValue(<ConceptName>)
  2. We can expose another api form.getValueOfControl(“Control_ID”)

@mksd @mksrom @angshuonline Any thoughts/Suggestions/Approaches on the current design?

1 Like