Generated with the help of an LLM.
Problem/Motivation
When a job is submitted with the workflow "AI translation" or "AI translation + human review", the module creates the Smartcat project and then calls POST /api/integration/v1/project/{id}/pretranslation-rules with one MT rule. This endpoint replaces the whole rule list. Smartcat creates a TM rule for the project's writable translation memory when it creates the project, so the call deletes that TM rule. Rules from a project template are deleted in the same way.
Result: the TM stays attached, but its matches are never inserted. All content goes through machine translation.
Steps to reproduce
- Use a Smartcat workspace with a writable translation memory for the language pair.
- Submit a job with the workflow "AI translation + human review" and no template.
- In Smartcat, open the project settings, or call
GET .../pretranslation-rules. - Only the "AI translation" (MT) rule is there. Without the module's call, the project also has a TM rule.
Proposed resolution
Read the current rules first (GET .../pretranslation-rules), append the MT rule after them, and post the full list. Do not send anything when the project already has an MT rule (for example, from a template).
Note: the API returns rule types in lower case ("mt", "tm") but accepts "MT", so compare without case.
Remaining tasks
Review the merge request.
Issue fork tmgmt_smartcat-3639005
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments