How To Use 
Register an account

Try For Free Now

Dark

Light

Announcement: Change of trial usage for new individual user (6/21)

Announcemnet: System Maintenance (Update: July 19)

Announcement: Change of trial usage for new individual user (6/21)

TEXT TRANSLATION
Text Translation Sync (Real-time translation engine)
Service will wait the translation response.
To reduce the response time of speech translation, we recommend the Real-time translation engine.
If you are using other translation engine, Please refer to the "Text Translation Sync" section.
Endpoint
Request details
POST
https://translate.rozetta-api.io/api/v1/translate
Header
Header
Description
Content-Type
application/json
accessKey, nonce, signature
Please refer to the authentication section.
Body
Key
Required
Description
fieldId
O
Professional field ID. If you are using real-time translation engine, please specify it as "1"
text
O
Original text. Specify an array of the texts to be translated; each array element is up to 200 words. The total array size of the texts should be less than 270KB.(about 90 thousands Japanese characters)
sourceLang
O
The language of the original text. Except for languages such as zh-CN and zh-TW, please use the ISO 639-1 code. Specify "auto" for automatic language detection. To get the list of supported languages, please refer to Languages section.
contractId
Contract ID. For user who has one contract, the field can be omitted. For user who has two or more contracts, it's required to specify the contractId. (e.g. User who has a Text translation contract and a Speech translation contract, has to specify the contract ID)
targetLang
O
The language of the translated text. Except for languages such as zh-CN and zh-TW, please use the ISO 639-1 code. To get the list of supported languages, please refer to Languages section.
autoSplit
Specify true for splitting long text(s)(more than 1000 words) into sentences automatically. Original text(s) in English, Japanese, and Chinese (zh-CN, zh-HK, and zh-TW) can be splitted automatically now.
Request Sample
{
    "fieldId": "1",
    "text": [
        "This is a pen.",
        "I like apple."
    ],
    "targetLang": "ja",
    "sourceLang": "en"
}
Response
Key
Description
status
For successful request, success will be specified for this field, otherwise failure will be specified. ※When a request contains multiple texts, even only one text is failed to translate, the entire request will be failed.
taskId
Task ID. This helps us to locate the root cause of the problem in timely manner when answering your enquiry.
translationResult
Translation results list.
sourceText
Original text.
translatedText
Translated text.
Response Sample
{
  "status": "success",
  "data": {
    "taskId": "ae914ccc-8866-43bc-8a26-0a652c4f1819",
    "translationResult": [
      {
        "sourceText": "This is a pen.",
        "translatedText": "これはペンです。"
      },
      {
        "sourceText": "I like apple.",
        "translatedText": "私はりんごが好きです。"
      }
    ]
  }
}

api/v1/translate
Translate "This is a pen." and "I have an apple." two sentences from English to Japanese.
// Define struct of request json body
type TranslateJson struct {
  FieldId string `json:"fieldId"`
  Text []string `json:"text"`
  TargetLang string `json:"targetLang"`
  SourceLang string `json:"sourceLang"`
}

// Post text and get translation results
func PostApiExample(accessKey, secretKey, basePath, nonce string) {
  translatePath := "/api/v1/translate"
    
  signTranslate := MakeHMAC(nonce, translatePath, secretKey)

  testJson := &TranslateJson{
    FieldId: "1",
    Text: []string{"This is a pen.", "I have an apple."},
    TargetLang: "ja", 
    SourceLang: "en",
    ContractId: "your contractId"}
  jsonValue, _ := json.Marshal(testJson)

  client := &http.Client{}
  req, err := http.NewRequest(
    "POST",
    GetFullUrl(basePath, translatePath),
    bytes.NewBuffer([]byte(jsonValue)),
  )
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("nonce", nonce)
  req.Header.Set("accessKey", accessKey)
  req.Header.Set("signature", signTranslate)
  res, err := client.Do(req)
    
  if err != nil {
    fmt.Printf("The HTTP request failed with error %s\n", err)
  } else {
    data, _ := ioutil.ReadAll(res.Body)
    fmt.Println(string(data))
  }
}
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.

^