本文整理自网络,侵删。

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 xe 与plc通讯(intcpserver 二进制)
Delphi getprocesshandleasname 获取进程句柄
Delphi comparestr 这个函数可以模糊匹配,且不区分大小写
Delphi中initialization和finalization
Delphi实现win10下Delphi 10.3.1 inline hook 修改mac网卡地址之getadaptersaddresses
更多相关阅读请进入《Delphi》频道 >>