Papago Website Translation overview
- Print
- PDF
Papago Website Translation overview
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
Overview
- This API translates html documents or elements from the source language into a target language.
- Translatable language pairs: Korean↔English, Korean↔Japanese, Korean↔Chinese (Simplified)
Precautions for use
- Text inside the image does not get translated.
- Some styles applied to the text may not match or will be omitted.
- Some links or actions applied to the text may not work or will be omitted.
- There is a size limit for html parameters. (UTF-8 standard 200,000 bytes including tags, spaces, etc.)
- It is recommended to request an element in the translated region because a larger html parameter leads to a slower responseTime. (Refer to the examples of extracting the translation area below)
- Maximum recommended characters per time: 60,000 characters
- Maximum recommended characters per minute: 3,600,000 characters
- Billing: counting all characters including tags and spaces
Common settings
The client ID is issued by registering the application in the NAVER Cloud Platform console.
Register the application at AI Service > Papago Translation > APIs.
Select the registered application from AI Service > Papago Translation > APIs, and check the client ID and client secret value.
Ensure that Papago Website Translation is selected from AI Service > Papago Translation > APIs > Edit. Note that error 429 (Quota Exceeded) will occur unless Papago Language Detection is selected.
Errors
Common errors
{
"error": {
"errorCode": "300",
"message": "Not Found Exception"
}
}
HttpStatusCode | ErrorCode | ErrorMessage | Description |
---|---|---|---|
400 | 100 | Bad Request Exception | Request error such as protocol (https) or encoding (UTF-8) |
401 | 200 | Authentication Failed | Authentication failure |
401 | 210 | Permission Denied | No permission |
404 | 300 | Not Found Exception | No permission |
429 | 400 | Quota Exceeded | Quota exceeded |
429 | 410 | Throttle Limited | Rate exceeded |
429 | 420 | Rate Limited | Rate exceeded |
413 | 430 | Request Entity Too Large | content-length exceeded (10 MB) |
503 | 500 | Endpoint Error | Endpoint connection error |
504 | 510 | Endpoint Timeout | Endpoint connection time exceeded |
500 | 900 | Unexpected Error | Error without exception handling |
API errors
{
"code": "20001",
"message": "Source and target are equal.",
"displayMessage": "Source and target are equal."
}
HttpStatusCode | ErrorCode | ErrorMessage | Description |
---|---|---|---|
500 | 00000 | API called failed | Internal server error |
400 | 00001 | Request is invalid | If there are no source, target, or html parameters |
500 | 20001 | Source and target are equal | If source and target are the same |
400 | 20006 | Exceed max requests size allowed | The html parameter exceeds the maximum capacity. |
400 | N2MT02 | Unsupported source language | The source language is unsupported. |
400 | N2MT04 | Unsupported target language | The target language is unsupported. |
Examples of extracting translation area
The sample code below extracts areas to be translated using the className, and this is just one of many ways to extract areas. We recommend using the method that is most suitable for your specific requirements.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Example</title>
</head>
<body>
<!-- comments -->
<ul class="comment_container">
<!-- comment -->
<li class="comment_item_wrapper">
<div class="user_info">
<span class="nickname">user1</span>
</div>
<div class="content">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Natus
nostrum in earum minus voluptates nobis fugiat rerum totam illum
ipsum.
</p>
</div>
</li>
<!-- comment -->
<!-- comment -->
<li class="comment_item_wrapper">
<div class="user_info">
<span class="nickname">user2</span>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet.</p>
</div>
</li>
<!-- comment -->
<!-- comment -->
<li class="comment_item_wrapper">
<div class="user_info">
<span class="nickname">user3</span>
</div>
<div class="content">
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ex tempora
ipsa iusto temporibus consectetur. Libero sequi consequatur
quibusdam dignissimos totam, praesentium harum dolor nisi
repudiandae in error tempora incidunt aperiam.
</p>
</div>
</li>
<!-- comment -->
<!-- comment -->
<li class="comment_item_wrapper">
<div class="user_info">
<span class="nickname">user4</span>
</div>
<div class="content">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Natus
nostrum in earum minus voluptates nobis fugiat rerum totam illum
ipsum.
</p>
<br>
<p>Lorem ipsum dolor sit amet.</p>
</div>
</li>
<!-- comment -->
</ul>
<!-- comments -->
<script>
const comments = [
...document.getElementsByClassName('comment_item_wrapper'),
];
const htmlsToRequest = comments.map((comment) => comment.outerHTML);
console.log(htmlsToRequest);
</script>
</body>
</html>
Was this article helpful?