连接Google翻译的在线翻译辞典界面(GTK)
- stringtang
- 帖子: 24
- 注册时间: 2008-12-04 8:46
- 联系:
连接Google翻译的在线翻译辞典界面(GTK)
中文翻英文还有点问题,因为解码的缘故。有兴趣的同学可以一起来改进之(比如将语言种类扩展和加入其他在线辞典等):)
编译平台ubuntu 8.04, gcc (GCC) 4.2.4
我的Email: junyi.hit (AT) gmail.com
编译平台ubuntu 8.04, gcc (GCC) 4.2.4
我的Email: junyi.hit (AT) gmail.com
- 附件
-
- odict.tar.gz
- (20.45 KiB) 已下载 371 次
- lerosua
- 论坛版主
- 帖子: 8455
- 注册时间: 2007-11-29 9:41
- 联系:
Re: 连接Google翻译的在线翻译辞典界面(GTK)
不错。支持~
- snyh
- 帖子: 70
- 注册时间: 2008-03-05 15:19
Re: 连接Google翻译的在线翻译辞典界面(GTK)
刚下下来看了下。。。。
很意外的是 你程序里面竟然用
gtk_signal_connect ();
而不是g_signal_connect ();......
虽然完成同样的工作不过。。。
很意外的是 你程序里面竟然用
gtk_signal_connect ();
而不是g_signal_connect ();......
虽然完成同样的工作不过。。。
- md5xwl
- 帖子: 133
- 注册时间: 2008-10-29 22:16
- 联系:
- jioyo源
- 帖子: 3476
- 注册时间: 2008-10-08 13:48
Re: 连接Google翻译的在线翻译辞典界面(GTK)
不错……
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
Re: 连接Google翻译的在线翻译辞典界面(GTK)
代码: 全选
☎ cat g-translate.pl
#!/usr/bin/perl
use Getopt::Long;
GetOptions('n'=>\$notify);
my $out,$in,$str;
# 无参数时,使用剪贴板内容。
$in=join('+',@ARGV);if(!$in){$in=`xsel -o`;} if(!$in){exit;}
$in=`echo "$in"|uni2ascii -a J -s`;
$in=~s/ /+/g; $in=~s/["']//g;
chomp $in;
if($in=~/%/){$str="zh-CN%7Cen";}else{$str="en%7Czh-CN";}
$out="curl -e http://www.my-ajax-site.com 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$in&langpair=$str' 2>/dev/null";
$out=`$out`;
$out=~/translatedText":"(.*?)"/;
if($notify){`notify-send 'google翻译' "$1"`;}
else{print $1;}
● 鸣学
- liujingjing5
- 帖子: 512
- 注册时间: 2006-10-12 1:21
Re: 连接Google翻译的在线翻译辞典界面(GTK)
楼主那个是提交返回的是整个页面,太大了.eexpress 写了:代码: 全选
☎ cat g-translate.pl #!/usr/bin/perl use Getopt::Long; GetOptions('n'=>\$notify); my $out,$in,$str; # 无参数时,使用剪贴板内容。 $in=join('+',@ARGV);if(!$in){$in=`xsel -o`;} if(!$in){exit;} $in=`echo "$in"|uni2ascii -a J -s`; $in=~s/ /+/g; $in=~s/["']//g; chomp $in; if($in=~/%/){$str="zh-CN%7Cen";}else{$str="en%7Czh-CN";} $out="curl -e http://www.my-ajax-site.com 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$in&langpair=$str' 2>/dev/null"; $out=`$out`; $out=~/translatedText":"(.*?)"/; if($notify){`notify-send 'google翻译' "$1"`;} else{print $1;}
你这是ajax的么?能具体说下参数的意思么?
我试了http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&langpair=zh-CN|en&q=你好
不行啊
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- liujingjing5
- 帖子: 512
- 注册时间: 2006-10-12 1:21
Re: 连接Google翻译的在线翻译辞典界面(GTK)
可以了,好像用|也行,可能是刚才什么地方出问题了了.
谢谢,谢谢
谢谢,谢谢
- lichuanjun56
- 帖子: 6
- 注册时间: 2009-04-16 12:00
- shift_bogoo
- 帖子: 7
- 注册时间: 2007-07-11 0:21
Re: 连接Google翻译的在线翻译辞典界面(GTK)
不错,我有兴趣参与,cabinw@gmail.com
-
- 帖子: 583
- 注册时间: 2008-10-15 10:49
- 来自: CS
Re: 连接Google翻译的在线翻译辞典界面(GTK)
支持
代码: 全选
_____________
< 呜呜buntu >
-------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||