Pricing 
API Pricing

Try For Free Now

Dark

Light

FILE TRANSLATION
File Translation Post
Send files to translate. 
You can upload multiple files at one time. 
You can also set a callback URL in advance. When the translation is finished, the result will be sent to the callback URL you provided. 
Please refer to Callback section.
File Translation can only be processed by T-4OO or T-3MT engine.
Endpoint
Request details
POST
https://translate.rozetta-api.io/api/v1/file-translate
Header
Header
Description
Content-Type
multipart/form-data
accessKey, nonce, signature
Please refer to the authentication section.
Body
Key
Required
Description
targetLangs
O
An array of translation languages. (an array of string) Specify a different language from the language of the file contents as the translation language. Except for some languages (such as zh-CN, zh-TW), please can specify them in ISO 639-1. For the supported languages, please refer to Languages section.
files
O
The array of files to be translated. File Size: less than 500MB Words: less than 270KB (about 90 thousands Japanese characters) Words of each paragraph(a line break): less than 500 words. Supported format: PDF, DOCX, XLSX, PPTX, XML No limitation on the number of pages. No limitation on the number of languages, but single language is recommended.
contractId
O
Contract ID. Specify the appropriate contract ID for the API you are using. e.g.Specify the text contract ID when using the text translation API, or specify the file contract ID when using the file translation API.
sourceLang
The language of original texts. (If a file contains several languages, please specify the main language please.) Except for languages such as zh-CN and zh-TW, please use the ISO 639-1 code. If yor are using automatic language detection, please omit the field. If you have short sentences, set sourceLang for short sentences, as the language autodetection does not recognise them well. To get the list of supported languages, please refer to Languages section. The language of the original text below is not supported now: am(Amharic) 、hy(Armenian) 、kn(Kannada) 、km(Khmer)、my(Myanmar)
Body (only for T-4OO engine)
Key
Required
Description
fieldId
O
Only applicable when using T-4OO engine. Specialized field ID. You can improve translation accuracy by specifying a proper field. Please refer to the Specialized Fields section. When using the T-3MT engine, please do not specify fieldId.
t4ooGlossaryId
Only applicable when using T-4OO engine. Glossary ID. When specifying more than one IDs, concatenate them with commas. e.g. 101,252,301 If no ID is specified, glossary will be applied by default. (Individual and Group) If you don't want to use glossary, please specify "-1". ※ID will be gained separately.
Body (only for T-3MT engine)
Key
Required
Description
domainId
O
Only applicable when using T-3MT engine. Specify 「T-3MT Field」 or 「mid」.
translateType
O
Only applicable when using T-3MT engine. Specify value "t3mt".
Request Sample
curl -X POST -H "nonce: Your Nonce" -H "accessKey: Your Access Key" -H "signature: Your Signature" -H "Content-Type: multipart/form-data" -F "files=@Your File Path" -F "targetLangs=[\"en\"]" -F "fieldId=1" https://translate.rozetta-api.io/api/v1/file-translate
Response
Key
Description
status
When a request succeeds, the status will be "success", otherwise it will be "failure".
data
Result object. You can use "translateId" to get the translated files.

api/v1/file-translate
Send the request to translate files.
JavaScript
C#
VB.NET
const superagent = require('superagent');
const fs = require('fs');
const path = require('path');
const config = require('./config');

const authUtils = require('./utils/auth-utils');

const url = '/api/v1/file-translate';

const sendRequest = async (serverConfig, accessKey, secretKey) => {
  const nonce = new Date().getTime().toString();
  const signature = authUtils.generateSignature(
    url,
    secretKey,
    nonce,
  );
  const langs = ['en'];
  superagent.post(`${serverConfig.protocol}//${serverConfig.hostname}:${serverConfig.port}${url}`)
    .set({
      accessKey,
      signature,
      nonce,
    })
    .attach('files', fs.createReadStream(path.join(
      __dirname,
      'sample-files',
      'testfile.docx',
    )), 'testfile.docx')
    .field('targetLangs', JSON.stringify(langs))
    .field('fieldId', '1')
    .field('contractId', 'your contractId')
    .end((_, resp) => {
      console.log(resp.text);
    });
};

const main = async () => {
  try {
    await sendRequest(
      config.serverConfig,
      config.authConfig.accessKey,
      config.authConfig.secretKey,
    );
  } catch (error) {
    console.error(error);
  }
};

main();
About the authentication, please refer to the authentication section.
You can get a full version of sample codes here
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta Corp.

^