Multilingual Projects

A very common use case is running multilingual projects. In Lilt, a project is always associated with one language, which means that the same project has to be created for every language. This can be automated via Lilt's API.

  1. For every language, create a new project

    # Python; Note: This is just a stub
    def create_project(projname, memoryid):
     payload = {"key": lilt_api_key}
     jsonData = {"name": projname, "memory_id": memoryid}
     res = + "/projects", params=payload, data=jsonData, verify=False)
     return res.json()["id"]
  2. Upload files into each project

    # Python; Note: This is just a stub
    def upload_document(filename, projid):
     payload = {"key": lilt_api_key}
     jsonData = {"name": filename, "project_id": projid}
     headers = { "LILT-API": json.dumps(jsonData), "Content-Type": "application/octet-stream" }
     with open(fileName, 'r') as fp:
         rawdata =
     res = + "/documents/files", params=payload, data=rawdata, headers=headers, verify=False)
     return res.json()["id"]

Optionally, you can check the file upload status and success by retrieving the document and extracting import_in_progress and import_succeeded.

After your projects are finished translating in Lilt, you can export the translated documents for all languages. If you stored the project IDs at creation time then you can use them to retrieve your projects and their documents to export them. You can also search for your projects by name and then retrieve all documents for download.

# Python; Note: This is just a stub
def export_project(projname):
    payload = {"key": lilt_api_key}
    res = requests.get(lilt_api_url + "/documents", params=payload, verify=False)
    allproj = res.json()
    for proj in allproj:
        if proj["name"] == projname:
            for doc in proj["documents"]:
                download_document(doc["name"] + srclang + trglang , doc["id"])

def download_document(filename, docid):
    payload = {"key": lilt_api_key, "id": docid, "is_xliff": "false"}
    res = requests.get(lilt_api_url + "/documents/files", params=payload, verify=False)
    with open(filename, 'wb') as fp:

To learn more, see the full API reference.

Still need help? Get in touch!
Last updated on 22nd April 2019