Marco Translator API Reference

Marco Translator

GET/POST /ai/text/marco/translator

By understanding the context of the content, Marco Translator can deliver high-quality translations of product information, support multilingual communication, and perform document translation tasks. It excels in translating e-commerce terminology and daily conversations.

Marco Translator supports translation between 34 languages, with a special focus on Chinese-English, Chinese to multilingual, and English to multilingual translations. Additionally, it offers language detection for 23 languages.

Request Parameters

Parameter
Type
Required
Description

text

String[]

Yes

Translation Text;

The total character length should not exceed 50,000, and the list length should not exceed 50. We also provide a Bulk API for offline translation of high volumes of product text. Please contact us for further assistance if needed.

Sample value:"[\"Pen for iPad, 13 mins Fast Charging Stylus with Palm Rejection, Tilt Sensitivity, Compatible with 2018-2022 iPad Air 3/4/5, iPad Mini 5/6, iPad 6/7/8/9/10, iPad Pro 11, iPad Pro 12.9 (Black)\"]"

sourceLanguage

String

No

Source language code, which can be viewed in the following translation supported language list.

If this parameter is not provided, the language will be automatically detected.

Sample value:"en"

targetLanguage

String

Yes

Target language code, which can be viewed in the following language detection supported language list.

Sample value:"ko"

formatType

String

No

The format type of source text;

Currently text/html are avaliable, default: text.

Sample value:"text"

glossary

String

No

Intervention glossary ID.

Intervention glossary IDs need to be created separately and provided in the input parameters. Multiple intervention glossaries can be passed. If the provided intervention glossary IDs are empty, the translation results will not be modified.

Self-service upload of intervention glossary IDs is not currently supported. Please contact us if needed.

Sample value:"translation_glossary"

Sample Request

The maximum response time for the interface is 30 seconds. It is recommended to set the request timeout to not exceed 30 seconds when making a call.

IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test, 
// request.addHeaderParameter("x-iop-trial","true")
request.setApiName("/ai/text/marco/translator");
request.addApiParameter("text", "[\"Pen for iPad, 13 mins Fast Charging Stylus with Palm Rejection, Tilt Sensitivity, Compatible with 2018-2022 iPad Air 3/4/5, iPad Mini 5/6, iPad 6/7/8/9/10, iPad Pro 11, iPad Pro 12.9 (Black)\"]");
request.addApiParameter("sourceLanguage", "en");
request.addApiParameter("targetLanguage", "ko");
request.addApiParameter("formatType", "text");
IopResponse response = client.execute(request, Protocol.TOP);
System.out.println(response.getBody());
Thread.sleep(10);I

Parameter Response

Parameter
Type
Description

resCode

Number

Response code; 200 indicates a successful call, other response codes can be referred to in the error code information.

data

Object

Result data that generated.

data.characters

Number

The number of characters translated.

data.translatedText

String

Result data that translated.

data.detectedLanguage

String

Language Detection Results.

requestId

String

Request ID: Used to uniquely identify a single request call.

success

Boolean

Whether successful;true is successful,false is unsuccessful.

resMessage

String

Error message,like "content has sensitive data, please try other input".

Sample Response

{
  "data": {
    "translations": [
      {
        "translatedText": "iPad용 펜, 손바닥 거부 기능이 있는 13분 고속 충전 스타일러스, 기울기 감도, 2018-2022 iPad Air 3/4/, iPad Mini 5/6, iPad 6/7/8/9/10, iPad Pro 11, iPad Pro 12.9와 호환 가능(검은색)",
        "characters": 142
      }
      "class": "com.aidc.service.api.client.translate.dto.CommonTranslationResponse"
  },
  "requestId": "2101364017192321239846748e03d8",
    "success": true,
    "resCode": 200,
    "resMessage": "success",
    "code": "0",
    "request_id": "2101236717192321239867892",
    "_trace_id_": "2101364017192321239846748e03d8"
}

Error Code

code
Error code
Description

500

system error

System error

501

rate limit exceed

The current interface has reached the current limit. Please contact us to increase the current limit value.

700

invalid input

The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.

801

model failed

Internal call exception, please contact us for troubleshooting.

1000

content has sensitive data, please try other input

The request parameters contain sensitive information and cannot be processed at this time. Please try a different input.

1001

content control failed, please retry

The risk control service failed. Please try again. If the error persists, please contact us.

1002

content risk filter failed, please contact us

Content risk filter failed, please contact us

1007

text language is not supported

Text language is not supported,please input correst language.

1100

The input text length is too long

The input text length is too long(MAX is 4096 Token),please input again with correct length.

Appendix

Supporting Languages

Language Name

Language Code

Arabic

ar

Azerbaijani

az

Bengali

bn

Burmese

my

Chinese (Simplified)

zh

Chinese (Traditional)

zh-tw

Czech

cs

Dutch

nl

English

en

Finnish

fi

French

fr

German

de

Greek

el

Hebrew

he

Hindi

hi

Hungarian

hu

Indonesian

id

Italian

it

Japanese

ja

Korean

ko

Malay

ms

Nepali

ne

Polish

pl

Portuguese (Portugal)

pt

Romanian

ro

Russian

ru

Sinhala

si

Spanish

es

Swedish

sv

Thai

th

Turkish

tr

Ukrainian

uk

Urdu

ur

Vietnamese

vi

Language Detection Supported Languages

Language Name

Language Code

Arabic

ar

Bengali

bn

Chinese (Simplified)

zh

Chinese (Traditional)

zh-tw

Dutch

nl

English

en

French

fr

German

de

Hebrew

he

Indonesian

id

Italian

it

Japanese

ja

Korean

ko

Malay

ms

Polish

pl

Portuguese (Portugal)

pt

Russian

ru

Spanish

es

Thai

th

Turkish

tr

Ukrainian

uk

Urdu

ur

Vietnamese

vi

FAQs(Frequently Asked Questions)

  1. Is the Intervention Capability Available in Bulk?

Yes. You only need to associate multiple intervention glossary IDs for it to take effect. However, self-service upload of intervention glossary IDs is not currently supported. If needed, please search for the Aidge Product Consultation & Service Group on DingTalk using the group number: 105455001046 to join and contact us.

  1. What Performance-Related Information Needs Confirmation During Integration?

The current translation API supports a maximum QPS of 10. If your QPS requirements exceed 10, please contact your account manager to confirm the following information and ensure resource allocation in advance:

  • Confirmation of SLA (Service Level Agreement), such as AVG RT / P99 RT / AVG QPS / peak QPS for different language pairs.

  • Confirmation of traffic proportions for different translation scenarios. For example, the traffic proportions for scenarios such as Description / Review / Title, etc.

  1. How to Set Certain Content Not to Be Translated?

When setting formatType to html, you can use the following html tags:

<span translate="no"> </span>
<span class="notranslate"> </span>
Notice

By using this API, you confirm that you are a legal owner of all intellectual property rights pertaining to the data and content that you provide to us via the API, or have obtained the necessary authorizations for us to receive and use the same from you. You further agree that you will not use this product or any output thereof for any unlawful, unethical, unauthorized or harmful activities.

Last updated

Was this helpful?