Web translation

Prev Next

Available in Classic and VPC

Translate all or specific areas of the HTML document that makes up a website into another language.

Note

Please note the following before use:

  • Text with images cannot be translated.
  • Some styles applied to text may not match or may be omitted.
  • Some links or actions applied to the text may not work or may be omitted.
  • HTML parameter size limit exists: 200,000 bytes including all characters including UTF-8-based tags, spaces, etc.
  • Larger HTML parameter sizes result in slower responses, so we recommend requesting element in the translation area.
  • Recommended maximum characters per call: 60,000 characters
  • Recommended maximum characters per minute: 3,600,000 characters
  • Billing: All characters counted, including tags and spaces.

Request

This section describes the request format. The method and URI are as follows:

Method URI
POST /translate

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
  • auto (automatic language detection) | ko (Korean) | en (English) | ja (Japanese)| zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian)
  • For information about language pairs for which translation is supported, see Languages supported for translation.
target String Required Language code of the target text
  • ko (Korean) | en (English) | ja (Japanese)| zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian)
  • For information about language pairs for which translation is supported, see Languages supported for translation.
glossaryKey String Optional Glossary ID
  • Customized translation is applied based on the glossary data.
  • Korean ⇔ English, Korean ⇔ Japanese, Korean ⇔ Chinese (Simplified), Korean ⇔ Chinese (Traditional), Korean ⇔ French, English ⇔ Japanese, English ⇔ Chinese (Simplified), English ⇔ Chinese (Traditional), English ⇔ Vietnamese, English ⇔ Thai, English ⇔ Indonesian, English ⇔ French, Japanese ⇔ Chinese (Simplified), Japanese ⇔ Chinese (Traditional)
html String Required Element of the entire HTML document or specific areas to translate
  • Up to 200,000 bytes can be entered (including UTF-8-based tags and spaces).
Note

Even without specifying the source language (specified to auto), it automatically detects the language and provides a translation result. In this case, additional fees do not incur for detecting languages but only for the number of characters requested for translation.

Languages supported for translation

The following describes the supported languages for translation.

Supported language Translation direction Supported language
Korean English, Japanese, Chinese (Simplified), Chinese (Traditional), Vietnamese, Thai, Indonesian, French, Spanish, Russian
English Korean, Japanese, Vietnamese, Thai, Indonesian, French
Japanese Korean, English
Chinese (simplified) Korean
Chinese (traditional) Korean

Request example

The request example is as follows:

When the entire HTML document is translated

The following is a sample request for translating an entire HTML document.

curl --location --request POST 'https://papago.apigw.ntruss.com/web-trans/v1/translate' \
--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=ja' \
--data-urlencode '<div> 안녕하세요. 파파고입니다.</div>'\''
<div papago-id="0" papago-translate="translated"><font class="papago-parent"><font class="papago-source" style="display:none;">
</font>
</font><font class="papago-parent"><font class="papago-source" style="display:none;"> 안녕하세요. 파파고입니다.</font>Hello, I'm Papago.</font><font class="papago-parent"><font class="papago-source" style="display:none;">
</font>
</font></div>%'

When the element in a specific area are translated

The following is a sample request for translating an element in a specific area.

curl --location --request POST 'https://papago.apigw.ntruss.com/web-trans/v1/translate' \
--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=ko' \
--data-urlencode 'html=<!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>
    <style>
      body {
        margin-top: 50px;
      }

      ul.comment_container {
        width: 500px;
        list-style-type: none;
      }

      li.comment_item_wrapper {
        margin-bottom: 5rem;
        padding: 10px 20px;
        border: 1px solid gray;
        border-radius: 10px;
      }

      .user_info {
        font-weight: bold;
      }
    </style>
  </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>'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
status_code Integer Response status
data String - Element in the entire translated HTML document or in a specific area

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:

When the entire HTML document is translated

The following is a sample response for translating an entire HTML document.

<div> こんにちは。パパゴです。</div>'\''

<div papago-id="0" papago-translate="translated">
    <font class="papago-source" style="display:none;">


    </font>
    <font class="papago-parent">Hello, I'm Papago.</font>
    <font class="papago-source" style="display:none;">


    </font>
</div>%

When the element in a specific area are translated

The following is a sample response for translating an element in a specific area.

<!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>
    <style>
      body {
        margin-top: 50px;
}

      ul.comment_container {
        width: 500px;
        list-style-type: none;
}

      li.comment_item_wrapper {
        margin-bottom: 5rem;
        padding: 10px 20px;
        border: 1px solid gray;
        border-radius: 10px;
}

      .user_info {
        font-weight: bold;
}
    </style>
  </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 adipiscing elit. Natus
            The nostrils minus the volume of the tympanic membrane, which is a part of the eardrum that is thickened for sweating.
            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 discussion group</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 adipiscing elit. Temporary
            Agree to temporbus constetur. Dummy results value
            Quibusdam dignissimos totam, praesentium harum dolorum nisi
            There is an error around the transient incident.
          </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 adipiscing elit. Natus
            The nostrils minus the volume of the tympanic membrane, which is a part of the eardrum that is thickened for sweating.
            Ipsum
          </p>
          <br>
          <p>Lorem ipsum dolor discussion group</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>