Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build with Azure AI Search, Speech, OpenAI, and Document Intelligence services.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-ai-translation-text-py.md
1# Azure AI Text Translation — Python SDK Quick Reference23> Condensed from **azure-ai-translation-text-py**. Full patterns (transliteration, dictionary lookup, sentence boundaries)4> in the **azure-ai-translation-text-py** plugin skill if installed.56## Install7```bash8pip install azure-ai-translation-text9```1011## Quick Start12```python13from azure.ai.translation.text import TextTranslationClient14from azure.core.credentials import AzureKeyCredential15client = TextTranslationClient(credential=AzureKeyCredential(key), region=region)16```1718## Non-Obvious Patterns19- API key auth requires `region` param: `TextTranslationClient(credential=..., region="eastus")`20- Source language param: `from_parameter="fr"` (not `from` — reserved word)21- Dict example model: `from azure.ai.translation.text.models import DictionaryExampleTextItem`22- Async: `from azure.ai.translation.text.aio import TextTranslationClient`2324## Best Practices251. Batch translations — send multiple texts in one request (up to 100)262. Specify source language when known to improve accuracy273. Use async client for high-throughput scenarios284. Cache language list — supported languages change infrequently295. Handle profanity appropriately for your application306. Use `html` text_type when translating HTML content317. Include alignment for applications needing word mapping32