On Mon, Aug 10, 2020 at 1:31 PM <jean-baptiste@holcroft.fr> wrote:
ok, i understand, but I'm using https://pypi.org/project/translation-finder/ to find files.

It allows to detect any kind of files supported by Weblate which makes it quite efficient to get translations. And the dev is really reactive (see issues I opened last year). Any bug reported also improve our translation platform.

that's awesome - we're also thinking to evaluate the same for https://github.com/transtats/transtats/issues/149
 

In addition, with this, it is easy for me to run test on a single package and then to extract files.

What kind of tests? We can add a step in YAML for those I guess! 
Currently, we execute all those written in .spec file before we extract translation files.
 

what would be the output of the API? An information on where to find the package? or will it tell where to find the translations files? Or provide the translations files directly?

There are two job related APIs: 
(1) to run a job: POST /api/job/run

for example: 
$ curl -d '{"job_type": "syncdownstream", "package_name": "anaconda", "build_system": "koji", "build_tag": "f33"}' -H 'Content-Type: application/json' -H 'Authorization: Token <your-transtats-api-token>' -X POST http://localhost:8080/api/job/run
{"Success":"Job created and logged. URL: http://localhost:8080/jobs/log/2a5966a9-3e5e-4ad1-b89e-1ee0e3b1651b/detail","job_id":"2a5966a9-3e5e-4ad1-b89e-1ee0e3b1651b"}

Here, the job is executed and logged. You can get your api-token after logging with fedora id. (see in the drop-down of user's email) Here, latest build for "f33" will be picked.

(2) to fetch job details: GET /api/job/{job_id}/log

(you can get job_id from the response of above api or from https://transtats.fedoraproject.org/jobs/logs page)

for example: 
$ curl https://transtats.fedoraproject.org/api/job/f483b6fd-824e-4e5b-96ae-d29fd2df0cf2/log
Output would be the json, containing all the info you see in "Job Log (output)" on details page of this job-id: https://transtats.fedoraproject.org/jobs/log/f483b6fd-824e-4e5b-96ae-d29fd2df0cf2/detail
Please try that on https://transtats.fedoraproject.org/api-docs/

As this output already contains translation stats, we can add translation memory (in the API response) as well.
In CLI demo of https://www.youtube.com/watch?v=jgXJZRj43M0 [at 21:20] you may see that working.
 

what would be the information required for this API to get results? the package name?

Please see curl command above!
 

what's the benefit of using an API to talk with transtats instead of subscribing to Fedora tooling to know when a new package goes to the pipeline and download it?

Well, its matter of choice. 
Transtats run syncdownstream job in the background every time a new package build is detected to keep package stats latest. GET /api/package/<package-name> HTTP/1.1
So, through APIs it can be integrated in CI and test pipelines easily. You may explain more; what API response you expect? We can work on a new template also!
 

in the future, I would like to reuse the translation files to produce other packages such as system wide langpacks. Eventually with new translations coming from translation memory/translation machine or even manual modification.
--
Jean-Baptiste