Configuring translations
There are several categories of translations that live within our software project:
Code
: We use a tool called Transifex (opens in a new tab) to automatically extract hard-coded words (e.g. "Click Here"), translate them in the Transifex UI, and contribute those translations back to the O3 RefApp.Terminology
: e.g. the CIEL code 121375 for Asthma has multiple existing translations attached to it (as you can see here (opens in a new tab)). If you were using that code and wanted a new language option, you would need that added as metadata on this concept.Forms
: If you already have translations attached to particular concepts you are using, you can have those translations show up in your forms. Simply don’t supply a label in the Form Builder, and then the form will automatically use the concept name instead. Note that because of differences in the form engines, it will show up as an unlabelled question in the Form Builder, but it will work in the Angular Engine. As of Oct 2023, the Angular Form Engine has more complete translation coverage than the React one (though we plan to improve that in the coming months).- If you add a brand-new locale not in O3 before, note that the form-entry-app currently expects translation files (ex. ar.json) to exist, so you may see issues with the forms loading. Workaround here: Issue O3-2492 (opens in a new tab).
Translation Overrides Specific to an Individual O3 Module
You can use the configuration system to provide localized translations for O3 components. This is useful if, for example, you want to change the label on a button or rename a link. This should not be used to translate components into a new locale. Instead, please help us out by adding those translations directly to the RefApp using Transifex (opens in a new tab).
For example, if you want to rename the "Start a Visit" action on the patient chart, you can use this configuration:
{
"@openmrs/esm-patient-chart-app": {
"Translation overrides": {
"en": {
"startVisit": "Check-in"
}
}
}
}
Translation overrides like this can be provided at any configuration level, including the configuration for a particular slot or an extension in a slot. Note that the string "Translation overrides" must be in exactly that case, the key, like "en" should be the locale you want to override the translation for and the translation key, e.g., "startVisit" should match what is in the translation file for the locale you want to override. Multiple languages can be specified by having multiple keys, e.g., "en" and "fr" would allow you to override the text in both English and French.