因为时间太紧,无意冒范论坛规则,请大家原谅;
在DELPHI里,如何用google在线翻译页面里:http://translate.google.cn/translate_t?hl=zh-CN#把要翻译的内容提交上去,然后得到它翻译回来的中文;
希望大家能伸出温暖的十指,200元不多,当是和大家学习学习,谢谢
在DELPHI里,如何用google在线翻译页面里:http://translate.google.cn/translate_t?hl=zh-CN#把要翻译的内容提交上去,然后得到它翻译回来的中文;
希望大家能伸出温暖的十指,200元不多,当是和大家学习学习,谢谢
解决方案 »
- 求大神们帮我解决一下这些接口的用途 delphi interface
- 100分求个好名字
- 又得麻烦大家了,这样的数据库怎么导入?
- 如何实现在ComboBox的下拉列表中显示TreeView树结构(或者与TreeView类似的数结构)?
- 请问各位大虾,你们的库存量是怎么得到的?
- 100分人人有,MCSD,MCSE拿多少工资啊?有没有意义啊?
- 一个关于paradox7表录入的问题(类型不兼容)???????????
- 求助class destructor,constructor等下面那段代码中的粗体的作用!谢谢!
- delphi中使用cport接收中文乱码求助
- 怎么样才知道记录被修改过?(关于 cachedupdates )
- groupbox显示位置
- DevExpres和FastReport相冲突了,有什么好办法解决?
function URLEncode(const S: string; const InQueryString: Boolean): string;
var
Idx: Integer; // loops thru characters in string
begin
Result := '';
for Idx := 1 to Length(S) do
begin
case S[Idx] of
'A'..'Z', 'a'..'z', '0'..'9', '-', '_', '.':
Result := Result + S[Idx];
' ':
if InQueryString then
Result := Result + '+'
else
Result := Result + '%20';
else
Result := Result + '%' + SysUtils.IntToHex(Ord(S[Idx]), 2);
end;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
word: string;
ms: TMemoryStream;
begin
ms := TMemoryStream.Create;
word := Memo2.Text;
IdHttp1.Get('http://translate.google.cn/translate_a/t?client=t&text=' + UrlEncode(Word, False) +'&sl=en&tl=zh-CN', ms);
ms.Position := 0;
Memo1.Lines.LoadFromStream(ms);
ms.Free;
end;
现在是如果翻译的字符超过一定数的时候会有抛出异常,你的方法比较简洁,能否再优化一下解决.
IdHttp1.Get('http://translate.google.cn/translate_a/t?client=t&text=' + UrlEncode(Word, False) +'&sl=en&tl=zh-CN', ms);换成POST后,都没有数据回来了.
http://translate.google.cn/translate_t?hl=zh-CN#能帮我看看吗,可能给个例子.