Translation customization

Hi everyone,

in Angola, we wanted to change some of the translations on the UI provided by core. That includes i.e. app title, home screen text and some other messages. Moreover, we wanted to add our own messages, i.e. for the Contact Support link.
It seems that there is no support currently for this functionality. Malawi does not have this problem, because they could override messages_en.json files in the malawi-ui codebase.
In our case, there is no support for messages_pt.json files in codebase itself so we could not use this solution. We’ve added some of the missing and changed some of the existing translations in core transifex project which helped, but we cannot rely on this because this would mean that we would need to wait for next core release to see those translations as they are stored in released images for each component. There is no mechanism currently to refresh translations in already released UI components or in reference-ui so it indicates we need to wait for next release to get changed translations.

We didn’t have much time to do the research for using the separate transifex project for Angola so we went with a simpler solution.
Basically, as a temporary solution, we disabled language selection by overriding its markup and hiding it. Then we’ve added a single messages_en.json with all Portuguese translations so those would be considered as default instead of English messages from the core. It’s easy to get a single translated file with messages for any language from build reference-ui image.
This allows us to also add our own new messages i.e. for the Contact Support link and change any Portuguese translation but for the cost of disabling language selection.

The proposed solution by the core team is to use Transifex to provide custom translations for Angola. The problem is that we cannot refresh translations in separate UI components when they are released. That indicates we need to have a single TX project for angola-ui which will contain all custom translations for the Angola project which is currently implemented. This solution requires to have the source file in angola-ui with all messages that we want to change (or all messages from all components). Then we can translate those selected messages on Transifex as it is done in the core.

Firstly I was thinking about adding support for defining messages_.json files in UI code to override translations from transifex. This would require a lot of changes and it seems that the core team would advise against this solution and would like to focus on using Transifex.

We could also consider doing another language specific for Angola, i.e. Portuguese (Angola). I’m not sure how this solution could work exactly, one of the problems that I see is that we would have the fifth language to select on language dropdown. This would require a way to parametrized which languages we want to retrieve from Transifex as it is not configurable for now.

I was also thinking about uploading every source message on the UI and all translations to a single project for implementation so stakeholders can change translations by themselves without any need to udpate the codebase but I’m not sure if it would be possible without overriding already changed translations.

Another outstanding issue is that currently there is no way to change translations for backend and from what I’ve understood there is a desire to modify them, i.e. email notifications.

What do you think about this topic? Do you have any ideas on how to solve this issue differently?

PS. Sorry for posting this just before Tech Committee call :frowning:

Best,
Mateusz Kwiatkowski

Hi Mateusz,

I think that the solution proposed by the core is the best one to proceed with.

There are multiple advantages I can think of:

  • There is no need to duplicate translations in multiple Transifex projects as there is no need to copy the messages provided by the core.
  • Adding the key of the overriding messages make it clear that the implementation takes ownership fo the specific message.

Best regards,
Nikodem Graczewski

Hey @mkwiatkowski,

Thanks for doing this extensive research and bringing your findings to the community.

I assume that the solution proposed to the core team would require that anytime the custom translations need to be changed, the angola-ui needs to be rebuilt?

Just thinking about it without knowing the existing process, I would ideally want there to be a way to provide custom translations during the system startup process, and not the build process. That way, if some message needs to be translated/overridden, the whole UI does not have to be rebuilt just for that purpose.

Having said that, the proposed solution by the core team seems like an acceptable compromise, as long as translations are not changed often, as it is not as much level of effort as other solutions.

Shalom,
Chongsun

Hi @Chongsun_Ahn,

Thank you for your response. From what I understand to see changes in translations the angola-ui image has to be rebuild. I agree that having some sort of mechanism that will apply changed translations would be the best solution.

Best,
Mateusz Kwiatkowski