Dev Notes for Translating Bahmni

The Basics

  • Translation to any non-English language needs to happen via the Bahmni project on the Transifex website.
  • The dev team owns all the locale_en.json files, and Transifex owns all the other locale_<lang>.json files.
    • You should continue to add new messages in the locale_en.json files in the source code
    • You should continue to also modify existing English messages in the locale_en.json files in the source code, just as you always have.
  • If you add a new app with a new set of locale_<lang>.json files, you need to configure transifex for this. See below.


Non-English Translation Files

Do NOT put any non-English translations directly into the source code (because we will be downloading translations done on the website, and this is done blindly, without any merge process).


More Details

  • The Bahmni Transifex project is under the OpenMRS project. This allows Bahmni and OpenMRS teams to share translators, and to share translation suggestions across multiple OpenMRS distributions, since most vocabulary and terms are similar.
  • Underneath the Bahmni Transifex Project, are multiple Resources (one for each locale_en.json file).


Changing an existing English message will invalidate any translations for that message, and they will need to be translated again. This is intentional. Even if you didn't change the message key, any existing translations were done against a different text, so for safety they are presumed to be invalid.


What we still need to do

  1. Define and document a process for if/when translations are reviewed and pulled into the codebase.
  2. Configure our build pipeline to automatically pull in (reviewed) translations.

How to add a new app

If you add a new app, with a new set of locale_<lang>.json files, you need to add this as a new resource in Transifex, and add it to the .tx/config file in our codebase.

First, to add the resource on Transifex (you need maintainer privileges for this):

  1. Go to https://www.transifex.com/openmrs/bahmni/content/, Add Resource, and upload the initial locale_en.json as a Key-Value JSON file.
  2. From within the newly created resource, go to Settings and add a category (e.g. "core" if it's part of the core Bahmni application)
  3. Back at https://www.transifex.com/openmrs/bahmni/content/ click Auto Update Resources and put the "raw" github link to the locale_en.json file.

Second, to update the our .tx/config file, you can use the transifex client app to do this (from the root of openmrs-module-bahmniapps):

tx set --auto-local -r bahmni.clinical-app 'ui/app/i18n/clinical/locale_<lang>.json' --source-lang en --type KEYVALUEJSON --execute

You don't need to use the transifex client app: it is straightforward to copy-paste-edit from an existing resource description in .tx/config.

Then push these changes up to github.