4.5 Azure AI Translator Service

Key Takeaways

  • Azure AI Translator provides text translation (130+ languages), document translation (preserving formatting), and custom translator (domain-specific models).
  • Text translation supports real-time translation of text strings via REST API with automatic language detection.
  • Document translation preserves the original document formatting (Word, PDF, PowerPoint, Excel, HTML) while translating content.
  • Custom Translator enables training domain-specific translation models using parallel text (source and target language pairs).
  • Transliteration converts text from one script to another (e.g., Japanese kanji to romaji) without translating the language.
Last updated: March 2026

Azure AI Translator Service

Quick Answer: Azure AI Translator provides text translation (130+ languages), document translation (preserving formatting), and custom translator (domain-specific models). The REST API supports real-time translation, transliteration, dictionary lookup, and automatic language detection.

Text Translation

Basic Translation API Call

import requests
import uuid

endpoint = "https://api.cognitive.microsofttranslator.com"
path = "/translate"
params = {
    "api-version": "3.0",
    "from": "en",
    "to": ["fr", "de", "es"]
}

headers = {
    "Ocp-Apim-Subscription-Key": "<your-key>",
    "Ocp-Apim-Subscription-Region": "eastus",
    "Content-Type": "application/json",
    "X-ClientTraceId": str(uuid.uuid4())
}

body = [{"text": "Hello, how are you?"}]

response = requests.post(
    endpoint + path,
    params=params,
    headers=headers,
    json=body
)

for translation in response.json()[0]["translations"]:
    print(f"{translation['to']}: {translation['text']}")
# Output:
# fr: Bonjour, comment allez-vous?
# de: Hallo, wie geht es Ihnen?
# es: Hola, como estas?

On the Exam: Note that the Translator API uses a different endpoint pattern than other Azure AI services. It uses api.cognitive.microsofttranslator.com with a subscription key AND region header. Also note the to parameter accepts an array for multi-language translation in a single call.

Key API Operations

OperationEndpointDescription
Translate/translateTranslate text to one or more languages
Detect/detectDetect language of input text
Transliterate/transliterateConvert text from one script to another
Dictionary Lookup/dictionary/lookupGet alternative translations for a word
Dictionary Examples/dictionary/examplesGet example sentences for a translation
Languages/languagesList all supported languages

Transliteration

# Convert Japanese text from kanji to Latin script
params = {
    "api-version": "3.0",
    "language": "ja",
    "fromScript": "jpan",
    "toScript": "latn"
}

body = [{"text": "こんにちは"}]
response = requests.post(
    endpoint + "/transliterate",
    params=params,
    headers=headers,
    json=body
)
# Output: "konnichiha"

Document Translation

Document translation translates entire documents while preserving formatting:

Supported Formats

FormatExtensions
Microsoft Office.docx, .xlsx, .pptx
PDF.pdf
HTML.html, .htm
Text.txt, .csv, .tsv
Rich Text.rtf
Markdown.md

Document Translation Workflow

  1. Upload source documents to Azure Blob Storage (source container)
  2. Create a target container for translated documents
  3. Generate SAS tokens for both containers
  4. Submit a batch translation request
  5. Poll for status until translation completes
  6. Download translated documents from the target container

Custom Translator

Custom Translator improves translation quality for domain-specific content:

FeatureDescription
Parallel textProvide aligned source-target sentence pairs
Document typesTraining, tuning, testing, phrase dictionary, sentence dictionary
Minimum data10,000 parallel sentences for meaningful improvement
EvaluationBLEU score measures translation quality
DeploymentCustom model deployed to a custom category ID

Using a Custom Model

params = {
    "api-version": "3.0",
    "from": "en",
    "to": "fr",
    "category": "my-custom-category-id"  # Custom model
}

On the Exam: Custom Translator questions typically test whether you know the minimum data requirements (10,000 parallel sentences), how to deploy a custom model (category ID), and how to evaluate quality (BLEU score).

Test Your Knowledge

Which header is required for Azure AI Translator API calls in addition to the subscription key?

A
B
C
D
Test Your Knowledge

What is transliteration?

A
B
C
D
Test Your Knowledge

What metric does Custom Translator use to evaluate translation quality?

A
B
C
D