Papago Website Translation overview
    • PDF

    Papago Website Translation overview

    • PDF

    Article Summary

    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.

    1. Register the application at AI Service > Papago Translation > APIs.

    2. Select the registered application from AI Service > Papago Translation > APIs, and check the client ID and client secret value.

    3. 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"
      }
    }
    
    HttpStatusCodeErrorCodeErrorMessageDescription
    400100Bad Request ExceptionRequest error such as protocol (https) or encoding (UTF-8)
    401200Authentication FailedAuthentication failure
    401210Permission DeniedNo permission
    404300Not Found ExceptionNo permission
    429400Quota ExceededQuota exceeded
    429410Throttle LimitedRate exceeded
    429420Rate LimitedRate exceeded
    413430Request Entity Too Largecontent-length exceeded (10 MB)
    503500Endpoint ErrorEndpoint connection error
    504510Endpoint TimeoutEndpoint connection time exceeded
    500900Unexpected ErrorError without exception handling

    API errors

    {
        "code": "20001",
        "message": "Source and target are equal.",
        "displayMessage": "Source and target are equal."
    }
    
    HttpStatusCodeErrorCodeErrorMessageDescription
    50000000API called failedInternal server error
    40000001Request is invalidIf there are no source, target, or html parameters
    50020001Source and target are equalIf source and target are the same
    40020006Exceed max requests size allowedThe html parameter exceeds the maximum capacity.
    400N2MT02Unsupported source languageThe source language is unsupported.
    400N2MT04Unsupported target languageThe 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?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.