Bitzsoft.Integrations.Translation.Youdao
1.0.0
dotnet add package Bitzsoft.Integrations.Translation.Youdao --version 1.0.0
NuGet\Install-Package Bitzsoft.Integrations.Translation.Youdao -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Translation.Youdao" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Translation.Youdao" Version="1.0.0" />
<PackageReference Include="Bitzsoft.Integrations.Translation.Youdao" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Translation.Youdao --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.Translation.Youdao, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Translation.Youdao@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Translation.Youdao&version=1.0.0
#tool nuget:?package=Bitzsoft.Integrations.Translation.Youdao&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.Translation.Youdao
有道智云文本翻译实现包 -- v3 SHA-256 签名(input 前后缀规则)、auto 检测回显、vocabId 术语词表、领域化翻译,实现 ITranslationProvider 统一契约。
功能特性
- 官方 API 直连:裸 HttpClient 直调
openapi.youdao.com/api,零厂商 SDK 依赖 - v3 签名:
sign = sha256(appKey + input + salt + curtime + 密钥),input = q 前 10 字符 + 长度 + 后 10 字符(短文本直接取 q) - auto 源语言:响应
l字段({检测语种}2{目标})解析并归一化(zh-CHS→zh、zh-CHT→zh-TW) - 术语词表:
VocabId服务端强约束译法(控制台维护);Domain领域化翻译(金融 / 医学等,需控制台开通) - 限流退避重试:net8+ 标准韧性 handler(429/503/504 指数退避),次数与基准延迟可配
- 请求审计:内置 RequestLogging 管道记录出站请求
- 健康探测:
CheckHealthAsync以最小代价(单字符翻译)探测可用性
安装
dotnet add package Bitzsoft.Integrations.Translation.Youdao
配置
appsettings.json
{
"Translation": {
"Youdao": {
"AppId": "your-youdao-appkey",
"AppSecret": "your-youdao-secret",
"VocabId": "",
"Domain": null
}
}
}
| 配置项 | 说明 | 必填 | 默认值 |
|---|---|---|---|
AppId |
有道智云应用 ID / appKey(继承统一 Options) | 是 | - |
AppSecret |
应用密钥(v3 签名用,脱敏落日志) | 是 | - |
Endpoint |
文本翻译 API 端点 | 否 | https://openapi.youdao.com/api |
BaseAddress |
端点覆盖(优先于 Endpoint) | 否 | - |
VocabId |
术语词表 ID(控制台创建) | 否 | 空 |
Domain |
领域化翻译标识(需开通) | 否 | 空 |
Timeout / MaxRetryAttempts / RetryBaseDelay |
超时与限流退避 | 否 | 30s / 3 / 500ms |
HttpClientName |
命名 HttpClient 标识 | 否 | YoudaoTranslationProvider |
注册服务
builder.Services.AddBitzsoftYoudaoTranslation(builder.Configuration);
注册后 ITranslationProviderFactory 可按编码 youdao 解析。
使用示例
var provider = factory.GetProvider(TranslationProviderCode.Youdao);
var result = await provider.TranslateAsync(new TranslationTextRequest
{
Text = "不可抗力条款",
SourceLanguage = "auto",
TargetLanguage = "en"
});
能力矩阵
| 能力 | 支持 | 说明 |
|---|---|---|
| 单文本翻译 | ✅ | 文本翻译 API |
| 批量翻译 | ✅ | 逐条调用保持顺序 |
| 语言检测 | ✅ | auto 微型翻译回读 l 字段(产生最小计费字符) |
| 领域词汇表(Terms) | ❌ | 术语经 VocabId 在控制台维护;请求内 Terms 被忽略 |
| HTML 格式 | ❌ | 不保留标签结构 |
| 健康探测 | ✅ | 单字符翻译探测 |
错误码收敛
| 有道原始错误码 | 统一错误码 |
|---|---|
| 101 / 103 / 113(参数 / 文本过长 / q 为空) | InvalidArgument |
| 102 / 3005(语言不支持) | LanguageNotSupported |
| 108 / 202 / 206 / 207(appKey 无效 / 签名失败 / 时间戳无效 / 重放) | AuthenticationFailed |
| 110 / 111 / 112 / 203 / 205(实例 / 账号 / IP / 平台不符) | AccessDenied |
| 401(账户欠费) | QuotaExceeded |
| 411 / 412 / 9411(频率受限) | RateLimited |
| 301 / 302 / 303 / 9303(查询与内部错误) | OperationFailed |
| 网络异常 / DNS 解析失败 | NetworkUnreachable |
| 超时 | Timeout |
相关包
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Bitzsoft.Integrations.Translation.Abstractions (>= 1.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Bitzsoft.Integrations.Translation.Abstractions (>= 1.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Bitzsoft.Integrations.Translation.Abstractions (>= 1.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Translation.Youdao:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.Translation.All
翻译服务聚合包 — 传统机翻(阿里云 / 百度 / 腾讯云 / 有道 / DeepL / Google 官方)+ AI 翻译(通义 Qwen-MT / 百度大模型 / 火山引擎大模型,OpenAI 兼容 / Anthropic net8+),配置存在性驱动注册 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 55 | 10/21/2026 |