Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Azure AI Text Translation SDK for real-time text translation, transliteration, language detection, and dictionary lookup. Use for translating text content in applications.
.claude/skills/azure-ai-translation-text-py/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-20 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-08 | ✗→✓ | ▲ Improved | — | — |
Client library for Azure AI Translator text translation service for real-time text translation, transliteration, and language operations.
bashpip install azure-ai-translation-text
bashAZURE_TRANSLATOR_KEY=<your-api-key> AZURE_TRANSLATOR_REGION=<your-region> # e.g., eastus, westus2 # Or use custom endpoint AZURE_TRANSLATOR_ENDPOINT=https://<resource>.cognitiveservices.azure.com
pythonimport os from azure.ai.translation.text import TextTranslationClient from azure.core.credentials import AzureKeyCredential key = os.environ["AZURE_TRANSLATOR_KEY"] region = os.environ["AZURE_TRANSLATOR_REGION"] # Create credential with region credential = AzureKeyCredential(key) client = TextTranslationClient(credential=credential, region=region)
pythonendpoint = os.environ["AZURE_TRANSLATOR_ENDPOINT"] client = TextTranslationClient( credential=AzureKeyCredential(key), endpoint=endpoint )
pythonfrom azure.ai.translation.text import TextTranslationClient from azure.identity import DefaultAzureCredential client = TextTranslationClient( credential=DefaultAzureCredential(), endpoint=os.environ["AZURE_TRANSLATOR_ENDPOINT"] )
python# Translate to a single language result = client.translate( body=["Hello, how are you?", "Welcome to Azure!"], to=["es"] # Spanish ) for item in result: for translation in item.translations: print(f"Translated: {translation.text}") print(f"Target language: {translation.to}")
pythonresult = client.translate( body=["Hello, world!"], to=["es", "fr", "de", "ja"] # Spanish, French, German, Japanese ) for item in result: print(f"Source: {item.detected_language.language if item.detected_language else 'unknown'}") for translation in item.translations: print(f" {translation.to}: {translation.text}")
pythonresult = client.translate( body=["Bonjour le monde"], from_parameter="fr", # Source is French to=["en", "es"] )
pythonresult = client.translate( body=["Hola, como estas?"], to=["en"] ) for item in result: if item.detected_language: print(f"Detected language: {item.detected_language.language}") print(f"Confidence: {item.detected_language.score:.2f}")
Convert text from one script to another:
pythonresult = client.transliterate( body=["konnichiwa"], language="ja", from_script="Latn", # From Latin script to_script="Jpan" # To Japanese script ) for item in result: print(f"Transliterated: {item.text}") print(f"Script: {item.script}")
Find alternate translations and definitions:
pythonresult = client.lookup_dictionary_entries( body=["fly"], from_parameter="en", to="es" ) for item in result: print(f"Source: {item.normalized_source} ({item.display_source})") for translation in item.translations: print(f" Translation: {translation.normalized_target}") print(f" Part of speech: {translation.pos_tag}") print(f" Confidence: {translation.confidence:.2f}")
Get usage examples for translations:
pythonfrom azure.ai.translation.text.models import DictionaryExampleTextItem result = client.lookup_dictionary_examples( body=[DictionaryExampleTextItem(text="fly", translation="volar")], from_parameter="en", to="es" ) for item in result: for example in item.examples: print(f"Source: {example.source_prefix}{example.source_term}{example.source_suffix}") print(f"Target: {example.target_prefix}{example.target_term}{example.target_suffix}")
python# Get all supported languages languages = client.get_supported_languages() # Translation languages print("Translation languages:") for code, lang in languages.translation.items(): print(f" {code}: {lang.name} ({lang.native_name})") # Transliteration languages print("\nTransliteration languages:") for code, lang in languages.transliteration.items(): print(f" {code}: {lang.name}") for script in lang.scripts: print(f" {script.code} -> {[t.code for t in script.to_scripts]}") # Dictionary languages print("\nDictionary languages:") for code, lang in languages.dictionary.items(): print(f" {code}: {lang.name}")
Identify sentence boundaries:
pythonresult = client.find_sentence_boundaries( body=["Hello! How are you? I hope you are well."], language="en" ) for item in result: print(f"Sentence lengths: {item.sent_len}")
pythonresult = client.translate( body=["Hello, world!"], to=["de"], text_type="html", # "plain" or "html" profanity_action="Marked", # "NoAction", "Deleted", "Marked" profanity_marker="Asterisk", # "Asterisk", "Tag" include_alignment=True, # Include word alignment include_sentence_length=True # Include sentence boundaries ) for item in result: translation = item.translations[0] print(f"Translated: {translation.text}") if translation.alignment: print(f"Alignment: {translation.alignment.proj}") if translation.sent_len: print(f"Sentence lengths: {translation.sent_len.src_sent_len}")
pythonfrom azure.ai.translation.text.aio import TextTranslationClient from azure.core.credentials import AzureKeyCredential async def translate_text(): async with TextTranslationClient( credential=AzureKeyCredential(key), region=region ) as client: result = await client.translate( body=["Hello, world!"], to=["es"] ) print(result[0].translations[0].text)
| Method | Description | |--------|-------------| | translate | Translate text to one or more languages | | transliterate | Convert text between scripts | | detect | Detect language of text | | find_sentence_boundaries | Identify sentence boundaries | | lookup_dictionary_entries | Dictionary lookup for translations | | lookup_dictionary_examples | Get usage examples | | get_supported_languages | List supported languages |
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-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
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 +65 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.