Does document translation keep tags or format of html file?

asked 2021-11-02T15:41:43.88+00:00

Hi there,

I just find azure provides API "document translation" which can translate html file.

I am wondering if only the texts in html file are changed. Also, the tags or format of html file keep the same after translation completes?

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
221 questions
No comments
{count} votes

Accepted answer
  1. answered 2021-11-03T05:43:06.84+00:00
    GiftA-MSFT 11,091 Reputation points

    Hi, yes only text is translated. Here's an example request and response:

    Request:

    curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=en&to=zh-Hans&textType=html" -H "Ocp-Apim-Subscription-Key: <client-secret>" -H "Content-Type: application/json; charset=UTF-8" -d "[{'Text':'<div class=\"notranslate\">This will not be translated.</div><div>This will be translated.</div>'}]"  
    

    Response:

       [  
        {  
            "translations":[  
                {"text":"<div class=\"notranslate\">This will not be translated.</div><div>这将被翻译。</div>","to":"zh-Hans"}  
            ]  
        }  
    ]  
    

    --- *Kindly Accept Answer if the information helps. Thanks.*

    No comments

0 additional answers

Sort by: Most helpful