microsoft/skills

azure-ai-translation-ts

用 TypeScript REST API 处理文本与批量文件翻译

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

azure-ai-translation-ts 是什么?

此 Skill 在一个文档中并列介绍两个 REST client:@azure-rest/ai-translation-text 负责文本翻译/语言检测/音译,@azure-rest/ai-translation-document 负责单文件或容器批量文档翻译。两者 API 路径和鉴权参数不能互换。

中文说明由本站依据来源整理;英文原文保留在页面下方。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 azure-ai-translation-ts,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 azure-ai-translation-ts

请在 Codex 的当前工作环境中安装并检查 azure-ai-translation-ts 这个 Skill。

项目身份:microsoft/skills / azure-ai-translation-ts
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-typescript/skills/azure-ai-translation-ts/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-typescript/skills/azure-ai-translation-ts/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 根据需求安装 text 或 document 包与身份依赖;准备 Translator endpoint 和 key/region 或适配的凭据。
  • 批量文档需 source/target Blob SAS,源和目标权限不同;本地单文档走 multipart 请求。
  • 确认当前 npm 包响应类型、成功状态和 operation-location header 的形态。

实际使用顺序

  1. 文本翻译用 TextTranslationClient 工厂,POST /translate,先 isUnexpected 再解析 value/translations。
  2. 文本转写与检测分别使用 /transliterate、/detect;语言列表通过 /languages 查询。
  3. 单文档直接 POST /document:translate 并接收文件流;批量用 /document/batches,随后取 operation ID 轮询并分页枚举文件状态。
  4. 所有写操作检查 HTTP 结果和目标文件位置;不要将含 SAS 的 URL 写进日志。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

请基于 azure-ai-translation-ts 用 TypeScript 写英语到中文的文本翻译代码草案,使用 REST client 工厂并用 isUnexpected 检查响应,再列出批量文件翻译与单文档接口的区别。先不请求服务。
预期结果

得到文本翻译调用草案和接口选择说明;未调用翻译服务。

使用前先看这些限制

使用条件与边界

  • 批量SAS示例需有真实 Azure Blob 客户端和正确 SAS scope/permissions;源文片段没有完整展示 Blob 容器对象创建。
  • 批量请求示例没有显示先检查初始响应是否 unexpected,正式代码需补全。
  • 源文单文档示例以状态字符串200作为成功例子,实际状态和响应流依版本确认。
针对这个 Skill 的疑问

常见问题

我只翻译一句话需要 Blob 吗?

不需要;文本翻译走 text client。Blob 容器是文档翻译批处理的输入与输出来源。

批量任务 POST 返回后文件在哪里?

先读取 operation ID 并轮询作业,再读取单文件状态与目标容器结果;POST接受不等于已完成。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

.github/plugins/azure-sdk-typescript/skills/azure-ai-translation-ts/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 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, transliteration, language detection, or batch document translation.

查看源文件章节 / Source sections
  • 原文:Azure Translation SDKs for TypeScript
  • 安装 / Installation
  • 原文:Environment Variables
  • 原文:Text Translation Client
  • 原文:Authentication
  • 原文:Translate Text
  • 原文:Translate with Options
  • 原文:Get Supported Languages
  • 原文:Transliterate
  • 原文:Detect Language
  • 原文:Document Translation Client
  • 原文:Authentication
  • 原文:Single Document Translation
  • 原文:Batch Document Translation
  • 原文:Get Translation Status
  • 原文:Get Supported Formats
  • 原文:Key Types
  • 原文:Best Practices
原文:Azure Translation SDKs for TypeScript

Text and document translation with REST-style clients.

安装 / Installation

```bash # Text translation npm install @azure-rest/ai-translation-text @azure/identity # Document translation npm install @azure-rest/ai-translation-document @azure/identity ```

原文:Environment Variables

```bash TRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com TRANSLATOR_SUBSCRIPTION_KEY=<your-api-key> TRANSLATOR_REGION=<your-region> # e.g., westus, eastus AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production ```

原文:Authentication

```typescript import 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); ```

原文:Translate Text

```typescript import 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}`); } } ```

原文:Translate with Options

```typescript const 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 }, ], }, ], }, }); ```

文件 SHA256:cc67e765bcbdc359e61d43f5d02b76110f0880f5058f3118e76deaacd53c0ba0

仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

Build translation applications using Azure Translation SDKs for JavaScript (@azure-rest/ai-translation-text, @azure-rest/ai-translation-document). Use when implementing text translation, transliteration, language detection, or batch document translation.

查看历史简介来源

历史收录数据

来源仓库microsoft/skills
Skill源路径.github/plugins/azure-sdk-typescript/skills/azure-ai-translation-ts/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源