Using the Language IO API to translate files
Formatting requests
- You can use cURL, Postman, and python or javascript libraries, or any other procedure supported by REST APIs.
- You must authenticate every request with a
x-api-keyheader.
Endpoints in this page
Accept: application/octet-stream. If you do not include the header, the rest API endpoint does not return the correct response. This is a requirement for the AWS API Gateway.Translate/file
Translates a piece of content to the specified target language.
| POST https://agw.golinguist.com/linguistnow/resources/v1/translate/file | |||
| Request Parameters | |||
| file | file | yes | Run File attachments for translation. See Using the File parameter below to see the valid values. |
| sourceLanguage | text | yes | Language that you translate from (see the list of supported language codes) |
| targetLanguage | text | yes | Language that you translate to (see the list of supported language codes) |
| Request Example (form-data) | |||
|
Here is what the form-data for a file translation request looks like in Postman: | |||
Requesting a translation
The sourceLanguage parameter is optional (see below). The targetLanguage parameter is mandatory. The maximum file size allowed is 6Mb.
The file translation feature supports the following file formats:
- image/jpg
- image/jpeg
- image/png
- image/bmp
- image/gif*
- application/msword (docx)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
- application/pdf**
- application/vnd.ms-powerpoint (pptx)
- application/vnd.openxmlformats-officedocument.presentationml.presentation
- application/vnd.ms-excel (xlsx)***
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* static gif only, not animated
** limited to 20 pages per document
*** you must specify a source locale to translate spreadsheets. Note that complex spreadsheet layouts (such as formulas, data tables, multi-column layouts, and graphs with labels or legends) may lead to formatting loss.
sourceLanguage parameter. If you are unable to provide it, the source language is detected automatically based on the content of the file. This may be helpful in any number of cases for which the source language is unknown (for example, when batch processing files with different source languages, or for attachments that are received into a system that does not detect the language of the message).Uploading a file
- In the Value column, click "Select files". Select a new file from your computer, or a file previously uploaded by you or a team member (for example, if you are translating the same file to another language).
- Set the sourceLanguage and targetLanguage as desired.
- Click Send.
Downloading a translation
When the translation is complete, the file is not immediately visible. To download it, follow these steps:
- Click the three-dot menu to the bottom-right of the request window:
- Select "Save response to file":
- Save the file to the desired folder.
Translated files have the same name as the source file, with a language code suffix. For example, if you translated "invoice.pdf" to French, the translated file is named "invoice_fr.pdf"
For example, formatting elements like strikethrough text (like
Language IO recommends that agents double-check the translated files and compare the formatting from the translated version to the original if there are questions.
"Machine Translated" watermark
Whenever possible, the translated document will show a disclaimer to let the user know that the file was machine translated, with as much information as possible. For example, if the document was translated with Google, the disclaimer may look like this:
Language IO can currently show this disclaimer in PDF files, but not in DOCX or PPTX files.