在网页中添加即时翻译器stardict

星际译王项目组资源下载列表:http://code.google.com/p/stardict-3/downloads/list

星际译王select&translate how to 即时翻译:http://www.stardict.cn/selectandtrans.php


怎样在其他网页上使用“即时翻译”?
收藏下面的这个代码,或者直接把它拖到您的工具栏:
javascript:void((function()%20{var%20element=document.createElement('script');%20element.setAttribute('src',%20'http://www.stardict.cn/initselect.php');%20document.body.appendChild(element);})())
然后打开任意网页,并且点击工具栏上的StarDict链接。


How to add "Select and Translate" in your website?
Put these codes in your website:
<script src="http://www.stardict.cn/js/stardict.js" type="text/javascript"></script>
<script type="text/javascript">
dictInit();
</script>

You can add "dict_username" and "dict_md5passwd" into this script, so you can use custom dictionaries.
eg.
<script src="http://www.stardict.cn/js/stardict.js" type="text/javascript"></script>
<script type="text/javascript">
dict_username="qinpengxiao";
dict_md5passwd="b9517b1e961f837be133cd172eb361cd";
dictInit();
</script>
Enable translate opinion:
If you want to show a "Enable translate opinion" in your webpage, put these codes in suitable place:
<span id="dict_status"></span>
* If you want to disable "Select and Translate" by default, add dict_enable=false; before dictInit();

Provide Dictionary Lookup Service in your website.
Insert these codes in your web page:Preview:

<form method="post" target="_blank"
action="http://www.stardict.cn/query.php">
<input maxlength=256 size=21 name=q /><br>
<a href="http://www.stardict.cn" target="_blank">StarDict</a>
<input type="hidden" name="cs" value="UTF-8" />
<input type="submit" value="Look Up" />
</form>


StarDict
* You may need to change "UTF-8" to the charset that you are using in your web page.


由于CSDN的编辑器中不能直接使用javascript(在编辑阶段会被直接过滤,不知CSS会否),所以没有在次页面实现即时翻译。

这个功能其实可以拓展为在网页中添加google custom search,同样的道理。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值