Website Translation
    • PDF

    Website Translation

    • PDF

    記事の要約

    Classic/VPC環境で利用できます。

    Papago Doc Translationのユースケースを紹介します。

    ウェブ翻訳領域の抽出

    htmlパラメータのサイズによってレスポンスが遅くなる状況が発生しないように、翻訳領域を抽出するユースケースを説明します。

    Python

    classNameで翻訳対象の領域を抽出する 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>
    </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 -->
    
        
      </body>
    </html>
    

    この記事は役に立ちましたか?

    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.