How to translate document in node JS given URL of document?

Nitish Kumar 45 Reputation points
2024-03-20T03:17:51.7266667+00:00

Hi,

I am using Azure translator for translating the document. It seems, quite tedious process to upload the document in azure blob storage container as explained here:

https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/quickstarts/asynchronous-rest-api?pivots=programming-language-javascript

What we want to accomplish:

--

Our document is hosted on S3 and thus have public URL. We directly want to pass this URL in azure translator API to translate document and get the result <either URL of document or document file itself>. Appreciate sample code if possible.

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

1 answer

Sort by: Most helpful
  1. navba-MSFT 16,605 Reputation points Microsoft Employee
    2024-03-20T07:03:11.71+00:00

    @Nitish Kumar Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that you want to translate a document using Azure Translator without uploading it to Azure Blob Storage. However, as per the current Azure Translator API documentation, it requires the documents to be in Azure Blob Storage.

    So, an active Azure Blob Storage account is required to use Document Translation.

    Also note that, Our Document Translation REST API mentions about the requirement of having Azure Blob storage.

    User's image

    Workaround:

    You can download the files from S3 to your local box and use this MicrosoftTranslator/DocumentTranslation tool to perform the translation:

    https://github.com/MicrosoftTranslator/DocumentTranslation

    User's image

    This tool makes use of the Azure Document Translation service. This app provides a local interface to that service, allowing you to translate a locally residing file or a folder, and receiving the translation of these documents in a local folder. The tool uploads the local documents, invokes the translation, monitors the translation progress, downloads the translated documents to your local machine, and then deletes the containers from the service.

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    0 comments No comments