All skills
iflytek avatar

/iflytek-translate

@0515799
by iflytekiflytek/ifly-skills218 stars
27

iFlytek Machine Translation (机器翻译) — translate text between Chinese, English, Japanese, Korean, French, Spanish, German, Russian, Arabic, Thai, Vietnamese, and many more languages. Use when the user wants to translate text. Pure Python stdlib, no pip dependencies.

Use this Skill: https://skilld.dev/gh/iflytek/ifly-skills/iflytek-translate

This session only. Nothing lands on disk.

README.md

≈615 tokens on demand. Your agent reads this file only when SKILL.md points to it.

iFly Translate

基于讯飞机器翻译 API,在多语言之间做文本翻译。对应脚本为 scripts/translate.py,纯 Python 标准库实现,无需安装第三方依赖。

前置条件

export IFLY_APP_ID="your_app_id"
export IFLY_API_KEY="your_api_key"
export IFLY_API_SECRET="your_api_secret"

兼容说明:设置任意 IFLY_* 凭证变量(包括空值)后,仅使用该组,缺项报错;未设置标准组时,依次尝试 XFYUN_*、XFEI_*,不跨组拼接。旧前缀会在 stderr 输出一次不含凭证值的迁移提示。

快速开始

# 默认中译英
python3 scripts/translate.py "你好世界"

# 指定源语言和目标语言
python3 scripts/translate.py -s en -t cn "Hello world"

# 从标准输入读取
echo "こんにちは" | python3 scripts/translate.py - -s ja -t cn

# 从文件翻译
python3 scripts/translate.py -f ./document.txt -s cn -t en

# 输出语言标签
python3 scripts/translate.py -v "你好"

# 输出原始 JSON
python3 scripts/translate.py --raw "测试翻译"

参数说明

参数 说明 默认值
text 待翻译文本;传 - 表示从标准输入读取 -
--file, -f 从文件读取文本 不传
--from, -s 源语言代码 cn
--to, -t 目标语言代码 en
--verbose, -v 输出源/目标语言标签 关闭
--raw 输出原始 JSON 响应 关闭

限制说明

  • 单次文本长度不超过 4096 字节。
  • 鉴权方式为 HMAC-SHA256,并带 Digest 请求头。
  • 脚本允许传 auto 作为源语言;实际是否可用取决于讯飞账号和接口能力。
  • 完整语种列表见官方文档。
  • 完整文档与错误码说明见 SKILL.md。

参考链接

扩展说明

常用语言代码

代码 语言 代码 语言
cn 中文 en 英语
ja 日语 ko 韩语
fr 法语 de 德语
es 西班牙语 ru 俄语
ar 阿拉伯语 th 泰语
vi 越南语 pt 葡萄牙语
it 意大利语 tr 土耳其语

支持常见别名,例如 zh -> cn、english -> en、japanese -> ja。

Source: SKILL.md on GitHub

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill provides text translation services using the iFlytek API. It follows security best practices by managing credentials through environment variables and using only Python's standard library for its implementation. All network operations are directed to official vendor domains, and no malicious patterns or security vulnerabilities were detected.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 0515799. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 20 hours ago.

Activeupdated last week
Other metadata
metadata
{
  "homepage": "https://www.xfyun.cn/services/machine_translation",
  "openclaw": "{\"emoji\":\"🌐\",\"dimensions\":[\"机器翻译\",\"多语言翻译\"],\"user_instructions\":[\"把这段话翻译成英文\",\"翻译成中文\",\"帮我翻译一下\"],\"requires\":{\"bins\":[\"python3\"],\"env\":[\"IFLY_APP_ID\",\"IFLY_API_KEY\",\"IFLY_API_SECRET\"]},\"primaryEnv\":\"IFLY_API_KEY\"}"
}

README badge

README badge for iflytek/ifly-skills/iflytek-translate