- Print
- PDF
Text translation
- Print
- PDF
Available in Classic and VPC
Translate and output entered text. The output results can be supplemented with glossary, honorific translation, and term replacement options.
Request
This section describes the request format. The method and URI are as follows:
Method | URI |
---|---|
POST | /translation |
Request headers
For information about the headers common to all Papago Translation APIs, see Common Papago Translation headers.
Request body
You can include the following data in the body of your request:
Field | Type | Required | Description |
---|---|---|---|
source | String | Required | Language code of the source text (source)
|
target | String | Required | Language code of the target text
|
text | String | Required | Text to translate
|
glossaryKey | String | Optional | Glossary ID
|
replaceInfo | String | Optional | Substitution translation index
|
honorific | Boolean | Optional | Whether to apply honorifics
|
You can also specify text that should not be translated with HTML <span> tags as follows.
<span translate="no"> </span> or <span class="notranslate"> </span>
When using tags, they do not count towards the character count and have the same supported languages as glossaryKey
and replaceInfo
. See Text Translation examples for examples of using the <span> tag.
Languages supported for translation
The following describes the supported languages for translation.
Source language | Translation direction | Languages supported (compatible) for translation |
---|---|---|
ko (Korean) | ⇔ | en (English), ja (Japanese), zh-CN (Chinese (Traditional)), zh-TW (Chinese (Simplified)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French), es (Spanish), ru (Russian), de (German), it (Italian) |
en (English) | ⇔ | ko (Korean), ja (Japanese), zh-CN (Chinese (Simplified)), zh-TW (Chinese (Traditional)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French), es (Spanish), ru (Russian), de (German) |
ja (Japanese) | ⇔ | zh-CN (Chinese (Simplified)), zh-TW (Chinese (Traditional)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French) |
zh-CN (Chinese (Simplified)) | ⇔ | zh-TW (Chinese (Traditional)) |
Request example
The request example is as follows:
If Content-Type: application/x-www-form-urlencoded
The request example if the request header's Content-Type
is application/x-www-form-urlencoded
is as follows:
curl --location --request POST 'https://naveropenapi.apigw.ntruss.com/nmt/v1/translation' \
--header 'X-NCP-APIGW-API-KEY-ID: {Client ID issued when registering the app}' \
--header 'X-NCP-APIGW-API-KEY: {Client secret issued when registering the app}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=auto' \
--data-urlencode 'target=en' \
--data-urlencode 'text=Hello, I like to eat apples while riding my bike.'
If Content-Type: application/json
The request example if the request header's Content-Type
is application/json
is as follows:
curl --location --request POST 'https://naveropenapi.apigw.ntruss.com/nmt/v1/translation' \
--header 'X-NCP-APIGW-API-KEY-ID: {Client ID issued when registering the app}' \
--header 'X-NCP-APIGW-API-KEY: {Client secret issued when registering the app}' \
--header 'Content-Type: application/json' \
--data '{
"source": "auto",
"target": "ko",
"text": "Advanced technology requires numerous beta tests and feedbacks. This process takes up a lot of time, but it must be done for development.",
"glossaryKey": "{glossaryKey}",
"replaceInfo": " ",
"honorific": "true"
}'
Response
This section describes the response format.
Response body
The response body includes the following data:
Field | Type | Required | Description |
---|---|---|---|
message | Object | - | Response result |
message.result | Object | - | Translation result details |
message.result.srcLangType | String | - | Source text language code |
message.result.tarLangType | String | - | Translated text language code |
message.result.translatedText | String | - | Translated text |
Response status codes
For information about the HTTP status codes common to all Papago Translation APIs, see Common Papago Translation response status codes.
Response example
The response example is as follows:
{
"message": {
"result": {
"srcLangType": "ko",
"tarLangType": "en",
"translatedText": "Hello, I like to eat apple while riding a bicycle."
}
}
}