Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Azure AI Document Translation SDK for batch translation of documents with format preservation. Use for translating Word, PDF, Excel, PowerPoint, and other document formats at scale.
.claude/skills/azure-ai-translation-document-py/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | — | — |
| case-12 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-01 | ✗→✓ | ▲ Improved | — | — |
Client library for Azure AI Translator document translation service for batch document translation with format preservation.
bashpip install azure-ai-translation-document
bashAZURE_DOCUMENT_TRANSLATION_ENDPOINT=https://<resource>.cognitiveservices.azure.com AZURE_DOCUMENT_TRANSLATION_KEY=<your-api-key> # If using API key # Storage for source and target documents AZURE_SOURCE_CONTAINER_URL=https://<storage>.blob.core.windows.net/<container>?<sas> AZURE_TARGET_CONTAINER_URL=https://<storage>.blob.core.windows.net/<container>?<sas>
pythonimport os from azure.ai.translation.document import DocumentTranslationClient from azure.core.credentials import AzureKeyCredential endpoint = os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"] key = os.environ["AZURE_DOCUMENT_TRANSLATION_KEY"] client = DocumentTranslationClient(endpoint, AzureKeyCredential(key))
pythonfrom azure.ai.translation.document import DocumentTranslationClient from azure.identity import DefaultAzureCredential client = DocumentTranslationClient( endpoint=os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"], credential=DefaultAzureCredential() )
pythonfrom azure.ai.translation.document import DocumentTranslationInput, TranslationTarget source_url = os.environ["AZURE_SOURCE_CONTAINER_URL"] target_url = os.environ["AZURE_TARGET_CONTAINER_URL"] # Start translation job poller = client.begin_translation( inputs=[ DocumentTranslationInput( source_url=source_url, targets=[ TranslationTarget( target_url=target_url, language="es" # Translate to Spanish ) ] ) ] ) # Wait for completion result = poller.result() print(f"Status: {poller.status()}") print(f"Documents translated: {poller.details.documents_succeeded_count}") print(f"Documents failed: {poller.details.documents_failed_count}")
pythonpoller = client.begin_translation( inputs=[ DocumentTranslationInput( source_url=source_url, targets=[ TranslationTarget(target_url=target_url_es, language="es"), TranslationTarget(target_url=target_url_fr, language="fr"), TranslationTarget(target_url=target_url_de, language="de") ] ) ] )
pythonfrom azure.ai.translation.document import SingleDocumentTranslationClient single_client = SingleDocumentTranslationClient(endpoint, AzureKeyCredential(key)) with open("document.docx", "rb") as f: document_content = f.read() result = single_client.translate( body=document_content, target_language="es", content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" ) # Save translated document with open("document_es.docx", "wb") as f: f.write(result)
python# Get all translation operations operations = client.list_translation_statuses() for op in operations: print(f"Operation ID: {op.id}") print(f"Status: {op.status}") print(f"Created: {op.created_on}") print(f"Total documents: {op.documents_total_count}") print(f"Succeeded: {op.documents_succeeded_count}") print(f"Failed: {op.documents_failed_count}")
python# Get status of individual documents in a job operation_id = poller.id document_statuses = client.list_document_statuses(operation_id) for doc in document_statuses: print(f"Document: {doc.source_document_url}") print(f" Status: {doc.status}") print(f" Translated to: {doc.translated_to}") if doc.error: print(f" Error: {doc.error.message}")
python# Cancel a running translation client.cancel_translation(operation_id)
pythonfrom azure.ai.translation.document import TranslationGlossary poller = client.begin_translation( inputs=[ DocumentTranslationInput( source_url=source_url, targets=[ TranslationTarget( target_url=target_url, language="es", glossaries=[ TranslationGlossary( glossary_url="https://<storage>.blob.core.windows.net/glossary/terms.csv?<sas>", file_format="csv" ) ] ) ] ) ] )
python# Get supported formats formats = client.get_supported_document_formats() for fmt in formats: print(f"Format: {fmt.format}") print(f" Extensions: {fmt.file_extensions}") print(f" Content types: {fmt.content_types}")
python# Get supported languages languages = client.get_supported_languages() for lang in languages: print(f"Language: {lang.name} ({lang.code})")
pythonfrom azure.ai.translation.document.aio import DocumentTranslationClient from azure.identity.aio import DefaultAzureCredential async def translate_documents(): async with DocumentTranslationClient( endpoint=endpoint, credential=DefaultAzureCredential() ) as client: poller = await client.begin_translation(inputs=[...]) result = await poller.result()
| Category | Formats | |----------|---------| | Documents | DOCX, PDF, PPTX, XLSX, HTML, TXT, RTF | | Structured | CSV, TSV, JSON, XML | | Localization | XLIFF, XLF, MHTML |
poller.status()This skill is applicable to execute the workflow or actions described in the overview.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +35 percentage points is the difference between those two pass rates over the 23 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.