flattenthecurve / guide

https://www.flattenthecurve.com
Creative Commons Attribution 4.0 International
38 stars 33 forks source link

Maintain or publish list of translation teams for each language #370

Open rousik opened 4 years ago

rousik commented 4 years ago

When we need to update the existing content we can do that by creating Lokalise tasks. Ideally this would be run for all live languages and be assigned to current teams of translators for each language.

When I tried to do this for #368 I was unable to figure out who are the current translators for each language. It would be nice to have public list of translators for each languages so that we can create new tasks accurately.

It seems to me that lokalise allows to maintain user groups that could be used exactly for this purpose (each language will have dedicated group of translators and/or sci-reviewers).

In either case, we need to agree on what is the ground truth and make it publicly available and discoverable.

rousik commented 4 years ago

Assigning to Nico as he probably knows the most about this area.

nditada commented 4 years ago

I guess the source of truth should be Lokalise, but I have no idea how to pull that info programmatically from there...

rousik commented 4 years ago

Looks like this information is stored in Lokalise in the form of contributors (not team-user entitites). Using the lokalise2 cli and jq tool I was able to extract the current user-to-language mappings.

First, I store project-id: 423383895e6b8c4b081a89.98184174 and token: for my Lokalise account in ~/lokalise.yml for ease-of-use.

Then I can extract language-to-user_ids mapping using this nasty one-liner transformation:

lokalise2 --config ~/lokalise.yml contributor list | \
  jq '[.contributors[] | { user_id: .user_id, language: [.languages[] | select(.is_writable) | .lang_iso][]}]|group_by(.language)| .[] | { language: .[0].language, user_ids: [.[].user_id]}'

When creating new lokalise tasks, either list of user ids or user groups can be specified for each language that is included in the task. We also recognize two kinds of tasks: 1. translation, 2. scientific review.

Therefore it would make sense to create translate-${lang_iso} and review-${lang_iso} groups and populate them with contributors or reviewers (is_reviewer attribute on contributor object).

We can then either add the new contributors to given user groups manually as part of onboarding or just sync the groups from the contributor-language association periodically.

My next step here will be creating said groups for the live languages.

rousik commented 4 years ago

To extract reviewers, the one-liner jq code should start with [.contributors[] | select(.is_reviewer) | ...

rousik commented 4 years ago

The reference command to create translators group for cs is this:

lokalise2 --config ~/lokalise.yml team-user-group create --is-admin=false --is-reviewer=false --languages '{ "reference": [640], "contributable": [765] }' --name translate/cs --team-id 17246

Unfortunately it seems that I don't have Lokalise permissions to do this ATM. Pending further permissions.

rousik commented 4 years ago

I'm still unable to run lokalise2 team-user-group create and I'm getting 403: Forbidden.