openmrs-module-initializer icon indicating copy to clipboard operation
openmrs-module-initializer copied to clipboard

Support translating AMPATH Form Names via ampathformtranslations domain

Open ibacher opened this issue 2 years ago • 5 comments

E.g.,

{
    "uuid": "6381a458-9504-418a-b3fe-2e023e6d2550",
    "form": "Test Form 1",
    "form_name_translation": "Formulaire de Teste",
    "description": "French Translations for 'Test Form 1'",
    "language": "fr",
    "translations": {
      "Page 1": "Première page",
      "Section 1": "Première section",
      "Height": "Taille"
    }
}

Implementation-wise, this translation should override the display string for the form, similar to how other domains do this.

ibacher avatar Feb 22 '23 14:02 ibacher

Hi @ibacher, not sure I clearly understand the goal here. IMO I'd think form_name_translation rather gets added to translations such that the frontend consuming this file is responsible for the display. Could you explain a little more how the display is consumed?

Ruhanga avatar Mar 27 '23 10:03 Ruhanga

@Ruhanga Basically, form_name_translation needs to override the value shown here:

Screenshot 2023-03-27 at 08 57 28

At that point, the frontend will not have loaded either the actual form JSON or the translations JSON. It's just a request to the form endpoint to get all the forms. Basically, we just want to override the REST API's display property for the current locale.

If we force the frontend to do this processing, we force it to make:

  1. A request to get the forms
  2. A request to get the translations for the forms
  3. Parse the JSON for each for and find the form_name_translation

While each of those three steps is relatively fast, the overall effect is a massive performance hit (even imagining, f/e, a instance with 20 forms, that's 21 HTTP requests to display.... table).

ibacher avatar Mar 27 '23 13:03 ibacher

Closed via #234

ibacher avatar Mar 29 '23 12:03 ibacher

Hi @Ruhanga , @ibacher should we update also the README? https://github.com/mekomsolutions/openmrs-module-initializer/blob/master/readme/ampathformstranslations.md to reflect this addition?

rbuisson avatar Mar 30 '23 14:03 rbuisson

Indeed, we should...

ibacher avatar Mar 30 '23 14:03 ibacher

@ibacher is this still current or we can close this issue?

mks-d avatar Jun 28 '24 13:06 mks-d

This is done.

ibacher avatar Jun 28 '24 14:06 ibacher