Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Text and document translation with REST-style clients.
.claude/skills/azure-ai-translation-ts/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✗→✓ | ▲ Improved | — | — |
Text and document translation with REST-style clients.
bash# Text translation npm install @azure-rest/ai-translation-text @azure/identity # Document translation npm install @azure-rest/ai-translation-document @azure/identity
bashTRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com TRANSLATOR_SUBSCRIPTION_KEY=<your-api-key> TRANSLATOR_REGION=<your-region> # e.g., westus, eastus
typescriptimport TextTranslationClient, { TranslatorCredential } from "@azure-rest/ai-translation-text"; // API Key + Region const credential: TranslatorCredential = { key: process.env.TRANSLATOR_SUBSCRIPTION_KEY!, region: process.env.TRANSLATOR_REGION!, }; const client = TextTranslationClient(process.env.TRANSLATOR_ENDPOINT!, credential); // Or just credential (uses global endpoint) const client2 = TextTranslationClient(credential);
typescriptimport TextTranslationClient, { isUnexpected } from "@azure-rest/ai-translation-text"; const response = await client.path("/translate").post({ body: { inputs: [ { text: "Hello, how are you?", language: "en", // source (optional, auto-detect) targets: [ { language: "es" }, { language: "fr" }, ], }, ], }, }); if (isUnexpected(response)) { throw response.body.error; } for (const result of response.body.value) { for (const translation of result.translations) { console.log(`${translation.language}: ${translation.text}`); } }
typescriptconst response = await client.path("/translate").post({ body: { inputs: [ { text: "Hello world", language: "en", textType: "Plain", // or "Html" targets: [ { language: "de", profanityAction: "NoAction", // "Marked" | "Deleted" tone: "formal", // LLM-specific }, ], }, ], }, });
typescriptconst response = await client.path("/languages").get(); if (isUnexpected(response)) { throw response.body.error; } // Translation languages for (const [code, lang] of Object.entries(response.body.translation || {})) { console.log(`${code}: ${lang.name} (${lang.nativeName})`); }
typescriptconst response = await client.path("/transliterate").post({ body: { inputs: [{ text: "这是个测试" }] }, queryParameters: { language: "zh-Hans", fromScript: "Hans", toScript: "Latn", }, }); if (!isUnexpected(response)) { for (const t of response.body.value) { console.log(`${t.script}: ${t.text}`); // Latn: zhè shì gè cè shì } }
typescriptconst response = await client.path("/detect").post({ body: { inputs: [{ text: "Bonjour le monde" }] }, }); if (!isUnexpected(response)) { for (const result of response.body.value) { console.log(`Language: ${result.language}, Score: ${result.score}`); } }
typescriptimport DocumentTranslationClient from "@azure-rest/ai-translation-document"; import { DefaultAzureCredential } from "@azure/identity"; const endpoint = "https://<translator>.cognitiveservices.azure.com"; // TokenCredential const client = DocumentTranslationClient(endpoint, new DefaultAzureCredential()); // API Key const client2 = DocumentTranslationClient(endpoint, { key: "<api-key>" });
typescriptimport DocumentTranslationClient from "@azure-rest/ai-translation-document"; import { writeFile } from "node:fs/promises"; const response = await client.path("/document:translate").post({ queryParameters: { targetLanguage: "es", sourceLanguage: "en", // optional }, contentType: "multipart/form-data", body: [ { name: "document", body: "Hello, this is a test document.", filename: "test.txt", contentType: "text/plain", }, ], }).asNodeStream(); if (response.status === "200") { await writeFile("translated.txt", response.body); }
typescriptimport { ContainerSASPermissions, BlobServiceClient } from "@azure/storage-blob"; // Generate SAS URLs for source and target containers const sourceSas = await sourceContainer.generateSasUrl({ permissions: ContainerSASPermissions.parse("rl"), expiresOn: new Date(Date.now() + 24 * 60 * 60 * 1000), }); const targetSas = await targetContainer.generateSasUrl({ permissions: ContainerSASPermissions.parse("rwl"), expiresOn: new Date(Date.now() + 24 * 60 * 60 * 1000), }); // Start batch translation const response = await client.path("/document/batches").post({ body: { inputs: [ { source: { sourceUrl: sourceSas }, targets: [ { targetUrl: targetSas, language: "fr" }, ], }, ], }, }); // Get operation ID from header const operationId = new URL(response.headers["operation-location"]) .pathname.split("/").pop();
typescriptimport { isUnexpected, paginate } from "@azure-rest/ai-translation-document"; const statusResponse = await client.path("/document/batches/{id}", operationId).get(); if (!isUnexpected(statusResponse)) { const status = statusResponse.body; console.log(`Status: ${status.status}`); console.log(`Total: ${status.summary.total}`); console.log(`Success: ${status.summary.success}`); } // List documents with pagination const docsResponse = await client.path("/document/batches/{id}/documents", operationId).get(); const documents = paginate(client, docsResponse); for await (const doc of documents) { console.log(`${doc.id}: ${doc.status}`); }
typescriptconst response = await client.path("/document/formats").get(); if (!isUnexpected(response)) { for (const format of response.body.value) { console.log(`${format.format}: ${format.fileExtensions.join(", ")}`); } }
typescript// Text Translation import type { TranslatorCredential, TranslatorTokenCredential, } from "@azure-rest/ai-translation-text"; // Document Translation import type { DocumentTranslateParameters, StartTranslationDetails, TranslationStatus, } from "@azure-rest/ai-translation-document";
language parameter to auto-detectisUnexpected(response) before accessing bodyThis 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-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | 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. 22 cases were attempted. The headline lift of +64 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
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.