Does document translation keep tags or format of html file?

Jizhou Yang (APTLY TECHNOLOGY CORPORATION) 21 Reputation points Microsoft Employee
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.
234 questions
No comments
{count} votes

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

    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.*

0 additional answers

Sort by: Oldest