Delphi 通过有道接口实现翻译
2022-11-25 09:09:43 作者:admin
本文整理自网络,侵删。

function GetTranslatedText(const OriText: string): string;var Json: TQJson;const WebRestApiUrl = 'http://fanyi.youdao.com/translate?&doctype=json&type=AUTO&i=%s';begin Json := TQJson.Create; try try Json.Parse(CSimpleGet(Format(WebRestApiUrl, [TURLEncoding.URL.Encode(OriText)]))); //CSimpleGet 这里可以搜索本站用 idhttp nethttpclient 实现获取 Result := Json.ItemByPath('\translateResult[0][0]\tgt').AsString; except on e: Exception do Result := ''; end; finally FreeAndNil(Json); end;end;
感谢 黑夜杀手 提供
相关阅读 >>
Delphi xe5 for android 退出提示
Delphi下载程序并且urldownloadtofile的进度提示
Delphi 判断文件是否是图像文件
Delphi 批量文件改名
Delphi 中的split 函数
Delphi 图像灰度化处理
Delphi 免杀下载者源代码
Delphi写的服务程序在服务管理器中显示“描述”
Delphi判断系统是否64位
Delphi jpg/jpeg 图片缩放函数
更多相关阅读请进入《Delphi》频道 >>
猜你喜欢
联络方式:
400-123-789
邮箱:xiachao@163.com
Q Q:12345678
微信公众号
微信二维码