Skip to main content

Create a Data Source

What is a Data Source? A Data Source is an object that links all of your translated content together for a given language. It allows the LILT system to reference all of your previous translations, TMX files and Termbases(TB) to provide you with the most accurate translation possible.

Things you will need:

  • API Key - All requests throught the LILT API use the API Key to authenticate.
  • (Optional) TMX File - TMX files contain sentence to sentence translations and serve as a basis for translating content, these files aren't necessary but can produce better Instant Translation results for your documents depending on the quality of the data provided.
  • (Optional) TB File - Your business likely has specific product names, advertising terminology, and other words that you may or may not want translated. Adding a TB (Termbase) file to the Data Source creates a managed way to translate certain words/phrases for your business.
note

Data Sources can also be referred to as Memories. Anywhere in the docs that mentions a memoryId or /memories endpoint is referring to a Data Source.

Create a Data Source

Creating a Data Source with LILT is a straight-forward process. For this example we will create a Data Source in English to German using Locales. If you want to try a different language, a list of supported languages and how to access them is available in the the Quick Start Guide. Here is an example API call to create a Data Source plus the Request body. See the API docs for more info

curl -X POST https://api.lilt.com/v2/memories?key=API_KEY \
--header "Content-Type: application/json" \
--data '{"name": "Test Data Source","srclang": "en","trglang": "de","srclocale": "US","trglocale": "DE"}'

Once the call is made you should expect to see a response that looks something like this:

{
"id": 1234,
"srclang": "en",
"trglang": "de",
"srclocale": "US",
"trglocale": "DE",
"name": "Test Data Source",
"is_processing": false,
"version": 78,
"created_at": 1489147692,
"updated_at": 1489147692,
"resources": ["string"]
}

Congratulations, you have successfully created a Data Source.

Add a TMX file/TB file to your Data Source

A Data Source is only as useful as the data stored within. LILT uses memories as a way to keep track of your organizations content in a language pair format. Adding data to an empty Data Source is a typical first step when onboarding to LILT. If your organization has done localization in the past, chances are that you have a tmx file/tb file that needs to be added to your Data Source to ensure that your historical data is taken into consideration by the LILT Transformative AI. For this example we will upload a tmx file called "test.tmx" using the import file endpoint

  curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \
--header "LILT-API: {\"name\": \"test.tmx\",\"memory_id\": 1234}" \
--header "Content-Type: application/octet-stream" \
--data-binary @test.tmx

This should elicit a 200 response that looks something like this:

{
"id": 123,
"isProcessing": 1
}

This response means is that the request was registered successfully and your file is being processed by LILT into Segments which will become part of the Data Source. This process is asynchronous and can be verified using the memories endpoint:

curl -X GET https://api.lilt.com/v2/memories?key=API_KEY&id=1234\

This request will give you a response similar to the creation logic, with the key difference of seeing the new resource in the resources list.

{
"id": 1234,
"srclang": "en",
"trglang": "de",
"srclocale": "US",
"trglocale": "DE",
"name": "Test Data Source",
"is_processing": false,
"version": 78,
"created_at": 1489147692,
"updated_at": 1489147692,
"resources": ["test.tmx"]
}