Using the Language I/O API to translate files
Formatting requests
- You can use cURL, Postman, and python or javascript libraries, or any other method supported by REST APIs.
- You must authenticate every request with a
x-api-key
header.
Endpoints in this page
Note: You must add the Header value
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 |
targetLanguage | text | yes | Language that you translate to |
Request Example (form-data) | |||
Here is what the form-data for a file translation request looks like in Postman: |
Requesting a translation
The sourceLanguage
and targetLanguage
parameters are 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
Note: Users in their trial period are limited to three file translation requests.
Uploading a file
Note: This procedure uses Postman as an example.
- 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"
Note: Translated images such as JPG files may show visual artefacts next to the translated parts of the image. This is a normal occurrence caused by the automated Optical Character Recognition (OCR) process.
Comments
0 comments
Please sign in to leave a comment.