Skill

Translate Documents with Azure AI

Python skill for batch and single-document translation with format preservation via Azure AI Document Translation.

Works with azure

91
Spark score
out of 100
Updated 24 days ago
Version 13.12.0

Add to Favorites

Why it matters

Leverage the Azure AI Document Translation SDK for Python to perform batch and single document translations. This skill enables format preservation and integration with Azure Blob Storage for seamless document processing.

Outcomes

What it gets done

01

Translate batch documents from Azure Blob Storage.

02

Translate individual documents with specified content types.

03

Manage translation jobs, including status checking and cancellation.

04

Utilize glossaries for consistent terminology in translations.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-azure-ai-translation-document-py | bash

Overview

Azure AI Document Translation SDK for Python

Python skill for Azure AI Document Translation, covering batch translation from Blob Storage into one or more target languages with format preservation, single-document translation without storage, glossary-based terminology control, and job/document status monitoring. Use when translating documents in bulk with formatting preserved, into one or more languages, or enforcing domain-specific terminology via a glossary.

What it does

This skill translates documents in batch with format preservation using the Azure AI Document Translation SDK for Python (pip install azure-ai-translation-document). A DocumentTranslationClient authenticates via AzureKeyCredential (API key) or the recommended DefaultAzureCredential (Entra ID), and batch translation reads and writes from Azure Blob Storage containers (AZURE_SOURCE_CONTAINER_URL/AZURE_TARGET_CONTAINER_URL), requiring SAS tokens with Read/List permission on the source and Write/List on the target. client.begin_translation starts a long-running job with one or more DocumentTranslationInput/TranslationTarget pairs, supporting multiple target languages from a single source in one call (each to its own target container), and returns a poller whose .status(), .details.documents_succeeded_count, and .details.documents_failed_count report progress. For a single file rather than a whole container, SingleDocumentTranslationClient.translate takes raw document bytes plus a target language and content type, returning translated bytes directly - no blob storage required. Job- and document-level status can be inspected via list_translation_statuses (all operations, with counts) and list_document_statuses (per-document status, target language, and error message if failed), and a running job can be stopped with cancel_translation. Domain-specific terminology is enforced via a TranslationGlossary (a CSV or similar file hosted in blob storage) attached to a translation target. The client also exposes get_supported_document_formats (DOCX, PDF, PPTX, XLSX, HTML, TXT, RTF, CSV, TSV, JSON, XML, XLIFF, XLF, MHTML) and get_supported_languages for discovery before submitting a job. An async client (azure.ai.translation.document.aio) mirrors the sync API with async/await for running multiple translation jobs concurrently.

When to use - and when NOT to

Use this skill when translating documents in bulk - contracts, reports, manuals - while preserving their original formatting, especially into multiple target languages at once, or when enforcing consistent domain-specific terminology via a glossary. It is not for simple inline text translation (a plain text-translation API would be simpler) and it requires Azure Blob Storage for batch jobs - single documents can bypass that via SingleDocumentTranslationClient, but multi-language or multi-document batch jobs cannot.

Inputs and outputs

Input is source documents in a Blob Storage container (or raw bytes for single-document translation) plus one or more target languages and an optional glossary. Output is translated documents written to target Blob Storage containers (or returned as bytes for single documents), with per-job and per-document status, success/failure counts, and error messages available via polling.

Integrations

Built on the Azure AI Document Translation Python SDK (DocumentTranslationClient, SingleDocumentTranslationClient), authenticated via AzureKeyCredential or Azure Identity's DefaultAzureCredential, reading from and writing to Azure Blob Storage with SAS-token-scoped access.

pip install azure-ai-translation-document

Who it's for

Python developers building document translation pipelines that need to preserve formatting across DOCX, PDF, PPTX, and other document types, translate into multiple languages at once, or enforce domain-specific terminology with glossaries.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.