Pre-translation using CLI error

Hello!

I’m trying to pre-translate my project using the cli v3.7.8
I type crowdin pre-translate --method=mt --engine-id=318966 --verbose -l=ca
I get

✔️  Fetching project info
⚠️  Out of 1 files, 1 of them were found locally:
        - app/src/intl/fr.json
❌ Pre-translation is running...
❌ Failed to pre-translate the project. **Please contact our support team for help**
❌ Wrong parameters:
<key: fileIds, code: isEmpty, message: Value is required and can't be empty>

I don’t understand what’s wrong

There are new and updated keys in fr.jso, which are missing in ca.json

Hi @alex-pex

For me it looks like problem is in file configuration. Like system can’t match files because of path is not specified (just an assumption) Configuration File | Crowdin Documentation

Did you use API for this? It should be easier to set up (I’ve seen today someone created a topic here in community, with link to Crowdin’s library in Postman) API v2 Reference

I have a config file. I can download and upload files. pre-translate finds the file to process but don’t succeed to complete.

The API might be a solution, but I want to use the CLI (it is easier for me than parsing 20 or 30 files in the real project)

Hi, looks like the system didn’t match your files.

The pre-translate command matches the local sources (according to the wild-card pattern) to the sources in the project, then it takes the ID of those sources (that belong to the project) and transmits them via API (CLI is based on API).

In your case fileIds - empty.

It is necessary that the structure of the project sources corresponds to the pattern, kindly review your configuration file.

The config matches (I used the GUI to set it)

I found a fix. It needed several tweaks

  • preserve_hierarchy: true needs to be set in crowdin.yml
  • --language parameter is mandatory
  • --branch parameter is mandatory (if you use versions)

The final command : crowdin pre-translate --method mt --engine-id 318966 --language ca --branch master

Hey all, just had the same case, was investigating it and found this topic, brilliant!

For my case it was an issue with preserve hierarchy, changing it to true helped. Now all works just perfect, so thanks for recommendation! :slightly_smiling_face: