{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/azure-ai-translation-ts",
  "version": "1.0.0",
  "name": "Azure Ai Translation Ts",
  "description": "Build translation applications using Azure Translation SDKs for JavaScript (@azure-rest/ai-translation-text, @azure-rest/ai-translation-document). Use when implementing text translation, transliter...",
  "system_prompt_fragment": "# Azure Translation SDKs for TypeScript\n\nText and document translation with REST-style clients.\n\n## Installation\n\n```bash\n# Text translation\nnpm install @azure-rest/ai-translation-text @azure/identity\n\n# Document translation\nnpm install @azure-rest/ai-translation-document @azure/identity\n```\n\n## Environment Variables\n\n```bash\nTRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com\nTRANSLATOR_SUBSCRIPTION_KEY=<your-api-key>\nTRANSLATOR_REGION=<your-region>  # e.g., westus, eastus\n```\n\n## Text Translation Client\n\n### Authentication\n\n```typescript\nimport TextTranslationClient, { TranslatorCredential } from \"@azure-rest/ai-translation-text\";\n\n// API Key + Region\nconst credential: TranslatorCredential = {\n  key: process.env.TRANSLATOR_SUBSCRIPTION_KEY!,\n  region: process.env.TRANSLATOR_REGION!,\n};\nconst client = TextTranslationClient(process.env.TRANSLATOR_ENDPOINT!, credential);\n\n// Or just credential (uses global endpoint)\nconst client2 = TextTranslationClient(credential);\n```\n\n### Translate Text\n\n```typescript\nimport TextTranslationClient, { isUnexpected } from \"@azure-rest/ai-translation-text\";\n\nconst response = await client.path(\"/translate\").post({\n  body: {\n    inputs: [\n      {\n        text: \"Hello, how are you?\",\n        language: \"en\",  // source (optional, auto-detect)\n        targets: [\n          { language: \"es\" },\n          { language: \"fr\" },\n        ],\n      },\n    ],\n  },\n});\n\nif (isUnexpected(response)) {\n  throw response.body.error;\n}\n\nfor (const result of response.body.value) {\n  for (const translation of result.translations) {\n    console.log(`${translation.language}: ${translation.text}`);\n  }\n}\n```\n\n### Translate with Options\n\n```typescript\nconst response = await client.path(\"/translate\").post({\n  body: {\n    inputs: [\n      {\n        text: \"Hello world\",\n        language: \"en\",\n        textType: \"Plain\",  // or \"Html\"\n        targets: [\n          {\n            language: \"de\",\n            profanityAction: \"NoAction\",  // \"Marked\" | \"Deleted\"\n            tone: \"formal\",  // LLM-specific\n          },\n        ],\n      },\n    ],\n  },\n});\n```\n\n### Get Supported Languages\n\n```typescript\nconst response = await client.path(\"/languages\").get();\n\nif (isUnexpected(response)) {\n  throw response.body.error;\n}\n\n// Translation languages\nfor (const [code, lang] of Object.entries(response.body.translation || {})) {\n  console.log(`${code}: ${lang.name} (${lang.nativeName})`);\n}\n```\n\n### Transliterate\n\n```typescript\nconst response = await client.path(\"/transliterate\").post({\n  body: { inputs: [{ text: \"这是个测试\" }] },\n  queryParameters: {\n    language: \"zh-Hans\",\n    fromScript: \"Hans\",\n    toScript: \"Latn\",\n  },\n});\n\nif (!isUnexpected(response)) {\n  for (const t of response.body.value) {\n    console.log(`${t.script}: ${t.text}`);  // Latn: zhè shì gè cè shì\n  }\n}\n```\n\n### Detect Language\n\n```typescript\nconst response = await client.path(\"/detect\").post({\n  body: { inputs: [{ text: \"Bonjour le monde\" }] },\n});\n\nif (!isUnexpected(response)) {\n  for (const result of response.body.value) {\n    console.log(`Language: ${result.language}, Score: ${result.score}`);\n  }\n}\n```\n\n## Document Translation Client\n\n### Authentication\n\n```typescript\nimport DocumentTranslationClient from \"@azure-rest/ai-translation-document\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nconst endpoint = \"https://<translator>.cognitiveservices.azure.com\";\n\n// TokenCredential\nconst client = DocumentTranslationClient(endpoint, new DefaultAzureCredential());\n\n// API Key\nconst client2 = DocumentTranslationClient(endpoint, { key: \"<api-key>\" });\n```\n\n### Single Document Translation\n\n```typescript\nimport DocumentTranslationClient from \"@azure-rest/ai-translation-document\";\nimport { writeFile } from \"node:fs/promises\";\n\nconst response = await client.path(\"/document:translate\").post({\n  queryParameters: {\n    targetLanguage: \"es\",\n    sourceLanguage: \"en\",  // optional\n  },\n  contentType: \"multipart/form-data\",\n  body: [\n    {\n      name: \"document\",\n      body: \"Hello, this is a test document.\",\n      filename: \"test.txt\",\n      contentType: \"text/plain\",\n    },\n  ],\n}).asNodeStream();\n\nif (response.status === \"200\") {\n  await writeFile(\"translated.txt\", response.body);\n}\n```\n\n### Batch Document Translation\n\n```typescript\nimport { ContainerSASPermissions, BlobServiceClient } from \"@azure/storage-blob\";\n\n// Generate SAS URLs for source and target containers\nconst sourceSas = await sourceContainer.generateSasUrl({\n  permissions: ContainerSASPermissions.parse(\"rl\"),\n  expiresOn: new Date(Date.now() + 24 * 60 * 60 * 1000),\n});\n\nconst targetSas = await targetContainer.generateSasUrl({\n  permissions: ContainerSASPermissions.parse(\"rwl\"),\n  expiresOn: new Date(Date.now() + 24 * 60 * 60 * 1000),\n});\n\n// Start batch translation\nconst response = await client.path(\"/document/batches\").post({\n  body: {\n    inputs: [\n      {\n        source: { sourceUrl: sourceSas },\n        targets: [\n          { targetUrl: targetSas, language: \"fr\" },\n        ],\n      },\n    ],\n  },\n});\n\n// Get operation ID from header\nconst operationId = new URL(response.headers[\"operation-location\"])\n  .pathname.split(\"/\").pop();\n```\n\n### Get Translation Status\n\n```typescript\nimport { isUnexpected, paginate } from \"@azure-rest/ai-translation-document\";\n\nconst statusResponse = await client.path(\"/document/batches/{id}\", operationId).get();\n\nif (!isUnexpected(statusResponse)) {\n  const status = statusResponse.body;\n  console.log(`Status: ${status.status}`);\n  console.log(`Total: ${status.summary.total}`);\n  console.log(`Success: ${status.summary.success}`);\n}\n\n// List documents with pagination\nconst docsResponse = await client.path(\"/document/batches/{id}/documents\", operationId).get();\nconst documents = paginate(client, docsResponse);\n\nfor await (const doc of documents) {\n  console.log(`${doc.id}: ${doc.status}`);\n}\n```\n\n### Get Supported Formats\n\n```typescript\nconst response = await client.path(\"/document/formats\").get();\n\nif (!isUnexpected(response)) {\n  for (const format of response.body.value) {\n    console.log(`${format.format}: ${format.fileExtensions.join(\", \")}`);\n  }\n}\n```\n\n## Key Types\n\n```typescript\n// Text Translation\nimport type {\n  TranslatorCredential,\n  TranslatorTokenCredential,\n} from \"@azure-rest/ai-translation-text\";\n\n// Document Translation\nimport type {\n  DocumentTranslateParameters,\n  StartTranslationDetails,\n  TranslationStatus,\n} from \"@azure-rest/ai-translation-document\";\n```\n\n## Best Practices\n\n1. **Auto-detect source** - Omit `language` parameter to auto-detect\n2. **Batch requests** - Translate multiple texts in one call for efficiency\n3. **Use SAS tokens** - For document translation, use time-limited SAS URLs\n4. **Handle errors** - Always check `isUnexpected(response)` before accessing body\n5. **Regional endpoints** - Use regional endpoints for lower latency\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.",
  "applicable_domains": [
    "devops"
  ],
  "category": "devops",
  "invocation": [
    "/azure-ai-translation-ts"
  ],
  "authored_by": "claudeskills.in community",
  "source_url": "https://claudeskills.in/skill/azure-ai-translation-ts",
  "provenance": {
    "source": "claudeskills.in",
    "source_url": "https://claudeskills.in/skill/azure-ai-translation-ts",
    "license": "unknown",
    "imported_at": "2026-09-03",
    "notes": "Aggregated by claudeskills.in from community GitHub lists."
  },
  "tags": [
    "claudeskills",
    "devops"
  ],
  "lifecycle": "draft"
}