How To Use 
Register an account

Try For Free Now

Dark

Light

TEXT TRANSLATION
Synchronization
Service will wait the translation response.
Synchronization is applied to T-4OO engine, Real-time, and T-3MT engine.
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. Select a professional field to improve the translation accuracy. Please refer to the Specialized Fields section. When using the T-3MT engine, please refer to the「T-3MT Field」 or「mid」.
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.
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.
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 File translation contract, has to specify the contract ID) You can determine which engine you are using from the contract ID.
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.
Body (only for T-4OO engine)
Key
Required
Description
removeFakeLineBreak
Only applicable when using T-4OO engine. When set to true (default), the translation engine will try to judge that if several lines of the input is actually one sentence, if it think they are, it will combine them to one sentence before translation. When set to false, the translation engine will not combine the original texts, and the texts will be translated as-is.
t4ooCategoryId
Only applicable when using T-4OO engine. Parallel translation ID. When specifying more than one IDs, concatenate them with commas. e.g. 101,252,301 If no ID is specified, parallel translation will be applied by default. (According to your fieldId) If you don't want to use parallel translation, please specify "-1". ※IDs are avaliable upon contact. ※isT4ooSplit might be necessary. Please refert to the example in isT4ooSplit.
t4ooGlossaryId
Only avaliable 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". ※IDs are avaliable upon request.
isT4ooSplit
Only applicable when using T-4OO engine. When set to false(default), each piece of text will be translated as a single unit. If true, each piece of text will be splitted into sentences and text will be translated in units of sentence. Here in below, you can observe the differences between specifying true and false. 【Parallel translation】”That is a dog.” “対訳試験” 【An element of text】”That is a bag.That is a dog.” 【Translate result(isT4ooSplit as false)】” あれはかばんです。あれは犬です。” 【Translate result(isT4ooSplit as true)】” あれはかばんです。対訳試験”
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.
wordCount
Word counts of all original texts.
Response Sample
{
  "status": "success",
  "data": {
    "taskId": "ae914ccc-8866-43bc-8a26-0a652c4f1819",
    "translationResult": [
      {
        "sourceText": "This is a pen.",
        "translatedText": "これはペンです。"
      },
      {
        "sourceText": "I like apple.",
        "translatedText": "私はりんごが好きです。"
      }
    ],
    "wordCount": 7
  }
}
Limitation
Limitation
Only applicable when using T-4OO engine. Each key(accessKey) can only send 60 requests in 1 minute, or it will return error. When this error is happened, please send your request after 60 seconds.

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.
You can get a full version of sample codes here
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta Corp.

^