libre 翻译
POST
/api/libreTranslate
最后修改时间:2024-10-30 07:07:57
请求参数
Query 参数
key
string
必需
示例值:
6tRiPmeoqYz3yOm15xN259zsTZpn6s6t6EMNtRD1nHrwfmm4ffCcY8slalqyPMwy
Body 参数application/json
from
string
源语言
to
string
目标语言
text
array[string]
翻译内容
platform
string
必需
示例
{
"from": "auto", // 源语言
"to": "zh-CHS", // 目标语言
"text": [ // 翻译内容
"Hello",
"world"
],
"platform": "Google" // 使用那个平台翻译不传入自动选择
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/libreTranslate?key=6tRiPmeoqYz3yOm15xN259zsTZpn6s6t6EMNtRD1nHrwfmm4ffCcY8slalqyPMwy' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": "auto", // 源语言
"to": "zh-CHS", // 目标语言
"text": [ // 翻译内容
"Hello",
"world"
],
"platform": "Google" // 使用那个平台翻译不传入自动选择
}'
返回响应
🟢200成功
application/json
Body
originalText
array[string]
原文
originalTextLen
integer
原文长度
platform
string
平台类型
to
string
目标语言
translate
array [object {2}]
翻译结果
text
string
必需
fromLang
string
必需
示例
{
"originalText": [
"Hello",
"world"
],
"originalTextLen": 10,
"platform": "Google",
"to": "zh-CHS",
"translate": [
{
"text": "你好",
"fromLang": "en"
},
{
"text": "世界",
"fromLang": "en"
}
]
}
修改于 2024-10-30 07:07:57