Configuring custom translations
Configuring custom translations for the CHT
This section will take you through translating the CHT to a custom language (in this guide, Swahili). This will include setting up the user interface labels as well as outgoing text messages.
Tip
If you need to translate the whole app into an entirely new language, please consider contributing those translations to the core project so they are available to the community.
By the end of the section you should be able to:
- Change the CHT user interface labels to a custom language.
- Change outgoing text messages to a custom language (Swahili).
Prerequisites
- A local CHT instance with
cht-confinstalled locally - A project folder
- CHT Swahili translations in a
messages-sw.propertiesfile.
Localization Steps
Create a translations/messages-sw.properties file in your project folder.
Populate the messages-sw.properties file with the appropriate translation and upload it onto your local CHT environment using the command below.
cht --url=https://medic:password@localhost --upload-custom-translationsor simply:
cht --local upload-custom-translations1. Add User Interface Label Translations
For non-admin users, CHT Instance text refers to the text that falls under Messages, Tasks, Reports, People and Targets.
To localize instance text to Swahili, change the default system language to Swahili.

Go to App Management > Display > Languages > Default Language(Change to Swahili)

To find out what the language code for Swahili is, go to the list of languages as illustrated in the screenshot, click Kiswahili (Swahili) to show the options dropdown and click Edit Name. The code will be in the text box under Language Code on the popup.

For this example, the language code is sw.
After changing the CHT instance language to Swahili, the various elements will behave like this:
Messages
In the Messages tab, the time counter text and navigation text changes, as in the screenshots below.

In English

In Swahili
To change the title of the tab from the default title of the Messages tab from Jumbe in Kiswahili to Barua, add or edit the below value in the messages-sw.properties file:
Messages = Jumbeto
Messages = BaruaTasks
Localize the Tasks header by adding the appropriate translation in the messages-sw.properties file.
For example, to translate the below delivery task title to Swahili:
{
name: 'anc-home-visit-delivery',
icon: 'icon-pregnancy',
title: 'task.anc.delivery.title',
}Add the value below to the messages-sw.properties file:
task.anc.delivery.title = Kazi ya Kujifungua
In English

In Swahili
To change the title of the tab from the default title of the Tasks tab from Kazi in Kiswahili to Fanya Hizi, add or edit the below code in the messages-sw.properties file:
Tasks = Kazito
Tasks = Fanya HiziReports
Localize the Reports tab field names by adding the appropriate translations in the messages-sw.properties file.
For example, to change the date of birth field to Swahili, in messages-sw.properties file, add this:
contact.type.date_of_birth = Siku ya Kuzaliwa
In English

In Swahili
To change the title of the tab from the default title of the Reports tab from Ripoti in Kiswahili to Ripoti hizi, add or edit the below code in the messages-sw.properties file.
Reports = Ripotito
Reports = Ripoti hiziPeople
To localize the People tab labels, add the appropriate translation in messages-sw.properties file.
To change the people name label translation from the default Swahili translation of Watu to Watu wa hili hapa eneo, in messages-sw.properties file, add the following values:
contact.type.person = Mtu wa hili hapa eneo
contact.type.person.plural = Watu wa hili hapa eneo
In English

In Swahili
To change the title of the People tab from Wasiliani in Kiswahili to Watu, add or edit the below code in the messages-sw.properties file.
People = Wasilianito
People = WatuTargets
To localize the People tab labels, add the appropriate translation in messages-sw.properties file.
To add the Growth Monitoring target title in Swahili, add the appropriate translation in the messages-sw.properties file.
targets.growth_monitoring.title = Ufuatiliaji wa ukuaji
Before

In Swahili
To change the title of the Targets tab from Grafu in Kiswahili to Lengo, add or edit the below code in the messages-sw.properties file.
Targets = Grafuto
Targets = Lengo2. RTL support
As of version 4.18.0, the CHT has support for Right to Left languages, and bundles Arabic translations. Setting the language to Arabic will automatically switch the UI to a mirrored design, to align with standard RTL writing and web elements.


Any language can be set to be a RTL language via App Management > Display > Languages > Add/Edit language

3. App Forms
To localize a CHT app form to Swahili, open the appropriate xlsx of the form and add a label::sw column which has the translation for the text. This will work in the Survey sheet or the choices sheet.

New Person app form XLS configuration

Default English translation

Form after switching CHV’s language to Kiswahili
The App Management - Admin Area section will still remain in English even after changing the default language to Swahili.
Note
The CHV can also choose the language of their choice when they login for the first time. A popup appears where they can choose their preferred language.
4. Outgoing Texts
In projects that incorporate SMS workflows, there are SMS notifications/replies that go to CHVs and Supervisors phones.
To change the language of outgoing texts for a CHV or Supervisor to Swahili, follow the steps below.
- In the
app_settings.json, when configuring replies, add Swahili language code (sw) underlocales:
"locales": [
{
"code": "en",
"name": "English"
},
{
"code": "es",
"name": "Spanish"
},
{
"code": "fr",
"name": "French"
},
{
"code": "ne",
"name": "Nepali"
},
{
"code": "sw",
"name": "Swahili"
}
]- Set up the translation for the reply message:
{
"messages":[
{
"message":[
{
"content":"Thank you, visit for {{patient_name}} ({{patient_id}}) has been recorded.",
"locale":"en"
},
{
"content":"Asante, kuhudhuria kwa {{patient_name}} ({{patient_id}} kumerekodiwa.",
"locale":"sw"
}
],
"event_type":"report_accepted",
"recipient":"reporting_unit"
}
]
}Did this documentation help you ?