0

When I create a weblate addon (component discovery) with the REST API,

**'curl -X POST -H "Content-Type: application/json" ' +
'-H "Authorization: Token **************" ' +
'-k -d "{' +
'\\"name\\":\\"weblate.discovery.discovery\\",' +
'\\"configuration\\":{' +
'\\"match\\":\\"locales/(?P^<language^>[^^/]*)/(?P^<component^>(?!__TEMPLATE__) ([^^/])*)\\\\.json\\",' +
'\\"file_format\\":\\"i18next\\",' +
'\\"name_template\\":\\"{{ component }}_fr\\",' +
'\\"base_file_template\\":\\"locales/fr/{{component}}.json\\",' +
'\\"new_base_template\\":\\"locales/fr/{{component}}.json\\",' +
'\\"language_regex\\":\\"^^[^^.]+$\\",' +
'\\"copy_addons\\":true,' +
'\\"remove\\":false,' +
'\\"confirm\\":true,' +
'\\"preview\\":true},' +
'\\"url\\":\\"\\"' +
'}" http://127.0.0.1/api/components/repositoryname/__template__fr/addons/'**

weblate does not automatically get the files that I push in the git repository.

To make it work, I first need to manually

  1. go to the discovery addon webpage in the web browser,
  2. save the addon in the web browser
  3. accept the list of files that match the template in the web browser.

Once this has been done one time, all the files that I push in the git repository are correctly discovered by weblate.

However we would like to do the 1), 2) & 3) steps automatically with the REST API.

I tried to set the confirm and preview fields of our CURL request to false but it does not work.

Is there a way to configure the CURL request so that weblate discover the files without any manual steps?

Warm regards.

Andrew Halil
  • 1,195
  • 15
  • 15
  • 21

1 Answers1

0

It should work. I've just added test to cover this to our test suite.

My guess would be that something is wrong in the JSON request - maybe something is not properly escaped or is escaped too much?

What does the curl request end with? What Weblate version do you use?

PS: The version info was posted here. You need to upgrade, this has been fixed in b9646f23174.

Michal Čihař
  • 9,799
  • 6
  • 49
  • 87