How To Use 
Register an account

Try For Free Now

Dark

Light

Announcement: End of support for old file type in File Translation (08/24)

Announcemnet: System Maintenance (Update: September 17)

Announcement: End of support for old file type in File Translation (08/24)

FILE TRANSLATION
File Translation Download
Download the files translated.
The files can be saved and downloaded for 14 days.
File Translation can only be processed by T-4OO or T-3MT engine.
Endpoint
Request details
GET
https://translate.rozetta-api.io/api/v1/downloads
Header
Header
Description
accessKey, nonce, signature
Please refer to the authentication section.
Parameter
Parameter
Require
Description
ids
O
Array of "translateItemId".
Request Sample
curl -H "nonce: Your Nonce" -H "accessKey: Your Access Key" -H "signature: Your Signature" https://translate.rozetta-api.info/api/v1/downloads?ids=8c76e418-9842-455b-aac1-5be28e8e4e94%2Cd290f1ee-6c54-4b01-90e6-d701748f0851
Response
Key
Description
N/A
zip file of the translat result.

api/v1/downloads
Download translated files.
const superagent = require('superagent');
const crypto = require('crypto');
const fs = require('fs');
const AdmZip = require('adm-zip');

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

const serverConfig = {
 protocol: 'https:',
 hostname: 'translate.rozetta-api.info',
 port: 443
};
const authConfig = {
 accessKey: 'YOUR_ACCESS_KEY',
 secretKey: 'YOUR_SECRET_KEY',
 nonce: new Date().getTime().toString()
};

const translateItemIds = 'your translateItemIds';

const sendRequest = (serverConfig, authConfig, translateItemIds) => {
  const itemIds = translateItemIds.split(',');
  
  const url = `/api/v1/downloads?ids=${JSON.stringify(itemIds)}`;
  const signature = authUtils.generateSignature(
    url,
    authConfig.secretKey,
    authConfig.nonce,
  );

  superagent.get(`${serverConfig.protocol}//${serverConfig.hostname}${url}`)
    .set({
      accessKey: authConfig.accessKey,
      signature,
      nonce: authConfig.nonce,
    }).end(function (req, resp) {
      if (resp.status === 200) {
        fs.createWriteStream('./output.zip').write(resp.body, (error) => {
          if (error) {
            console.error(error);
          } else {
            const zip = new AdmZip('./output.zip');
            zip.extractAllTo('./', true);
          }
        });
      }
    });
};

const main = async () => {
  if (!translateItemIds) {
    console.log("Error. please input translationItemId.");
    return;
  };
  try {
    await sendRequest(
      serverConfig,
      authConfig,
      translateItemIds
    );
  } catch (error) {
    console.error(error);
  }
};

main();
About the authentication, please refer to the authentication section.
About full sample code of each languages, please refer tohere
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta Corp.

^