Transifex integration with OpenMRS repositories

Right now, Transifex automatically pulls the latest source/English updates for messages from our repositories on GitHub. However, it does not push translations back to those repositories. I think it should.

There are a few ways (at least) we could approach this:

  1. The “native Transifex” way. Transifex wants there to be a 1:1 correspondence between Git repositories and Transifex projects. In our case, we have one project, “OpenMRS,” which has many “resources,” each of which correspond to a Git repo. If we instead make a Transifex project for each Git repo, then Transifex could be set up to automatically push translations to those repositories. See the Transifex docs.

  2. The GitHub Actions way. I’ve created a GitHub Action in openmrs-owa-orderentry which causes it to download and commit (if available) updated translations from Transifex nightly (also works on demand). We could add this action for any OpenMRS repository.

  3. The Git Hooks way. We could add a Git Hook to repositories so that any time you make a commit (or push, if you prefer), Git downloads new translations.

My preference is for route (2), because

  • I already have it working
  • Configuration in code! I’d much rather manage this process via YAML files than via the Transifex UI.
  • Runs on demand
  • Git Hooks can be messy, and would take developer time to do the downloading

If we’re in agreement, my only ask is that @burke or @mseaton (the two people who are both GitHub org owners and Transifex org owners) set up a generic OpenMRS bot account in Transifex, get an API token, and add it as a GitHub org secret.

At that point we should be able to create tickets for setting up translation sync for other repositories.

1 Like

Thanks @bistenes - makes sense to me. Just to echo my reply on Slack - I defer to our infra team and those who have access to organization secrets (@burke or @cintiadr most likely) for the creation of bot accounts and the management of authentication credentials for these that we want to keep track of.

I agree. Route 1 (the “native Transifex” way) could work well if we had a few repos, but isn’t manageable with dozens or hundreds of repos. And I don’t like route 3 (Git Hooks) because it sounds like it would introduce translations randomly into unrelated commits.

You should be able to use TRANSIFEX_TOKEN within your Github Action now.


@cintiadr pointed out on Slack:

We already do have some automation.

We have TRANSIFEX - Commit Translations to GitHub: Plan summary - OpenMRS Bamboo that gets translations from transifex using an API key and commits to github. We have TRANSIFEX - Auto Review Translations: Plan summary - OpenMRS Bamboo that autoreview translations

And I think transifex is automatically configured to get new strings from github

Which I suppose constitutes a “route 4” that I hadn’t considered. So maybe I should just add Bamboo tasks for the OWAs to those jobs? And also for each MFE ESM?

However, I’m very confused by the “auto-reviewing” thing. Why would we want that? As I wrote on Slack,

But why do we “auto-review” translations? Couldn’t we just run tx pull without --mode=reviewed to ignore review status, and then in Transifex we could actually differentiate reviewed from unreviewed translations?

We don’t. See here. We just never got to the stage of having a formal review process for translations.

It probably makes sense to keep that in Bamboo since we already have the credentials setup, etc.

@ibacher Nice, thanks for finding that thread. Can we just get rid of that job?

I don’t have any objection to it as long as it doesn’t break things…

Cool, I’m inclined to do that. Heads up @burke @cintiadr . I would also make tx pull pull non-reviewed translations. As a result, our translation workflow would be exactly the same, except that we would be able to differentiate reviewed from unreviewed translations in the Transifex UI.

I’ve disabled the auto-review job and submitted for review.

@bistenes I’ve merged that change. Thanks for that. What updates do we need to make to CI?

Thanks @ibacher ! I don’t think any additional changes are needed. I already disabled the auto-review job. We should add jobs for the OWAs and MFEs.