如何使用谷歌翻译工具自动翻译某个部分?
这更像是一个自动点击链接问题。但我的问题是这个链接是由谷歌的脚本生成的。 http://translate.google.com/translate_tools
如果您选择“翻译部分”,将会出现在 goog-trans-control
类中生成的链接
Original script:
<div class="goog-trans-section">
<div class="goog-trans-control">
</div>
Original Text here.
</div>
执行后的脚本代码(检查组件):
<div class="goog-trans-section">
<div class="goog-trans-control">
<div class="skiptranslate goog-te-sectional-gadget-link" style="">
<div id=":1.gadgetLink">
<a class="goog-te-gadget-link" href="javascript:void(0)">
<span class="goog-te-sectional-gadget-link-text">Translate</span>
</a>
</div>
</div>
</div>
Original Text here.
</div>
在此页面之后,我如何自动单击(或执行)翻译
链接完全加载?
由于某种原因,jsfiddle 无法与我的 脚本 一起使用,尽管为了您的方便我仍然发布此内容。 http://jsfiddle.net/Wb7tE/
非常感谢您的时间和帮助。
编辑:
我尝试了 Google 翻译 API,但有 5000 的限制一次说一句话。
我的翻译包括带有表格和脚本的整个 html,因此毫无例外地达到了极限。
This is more like a auto-click link problem. But my problem is this link is generate by google's script.
http://translate.google.com/translate_tools
If you choose "translate a section" , there will be a link generate inside the goog-trans-control
class
Original script:
<div class="goog-trans-section">
<div class="goog-trans-control">
</div>
Original Text here.
</div>
Script code after execute (Check Component):
<div class="goog-trans-section">
<div class="goog-trans-control">
<div class="skiptranslate goog-te-sectional-gadget-link" style="">
<div id=":1.gadgetLink">
<a class="goog-te-gadget-link" href="javascript:void(0)">
<span class="goog-te-sectional-gadget-link-text">Translate</span>
</a>
</div>
</div>
</div>
Original Text here.
</div>
How would I auto-click (or execute) the Translate
link after this page is totally loaded?
For some reason, jsfiddle is not working with my script, though I still post this for your convenience.
http://jsfiddle.net/Wb7tE/
Really appreciate for your time and help.
Edited:
I tried Google translate API, but there is a limitation of 5000 words at a time.
My translations include whole html with tables and scripts, so it reach the limit with no exception.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有一个类似的问题,我像这样暂时解决了它
,但在较慢的连接上,50%的时间谷歌不会按时加载,并且脚本在加载完成之前已经点击了。因此,如果有人知道任何其他方式来做到这一点,通过一些事件或类似的东西,请在此处添加...
PS 不要使用 Google Translation API,它已被弃用,并将在今年年底之前删除。
I have a similar problem, and I solved it temporally like this
but on slower connection, in 50 % of time google doesn't load on time, and script already clicks before loading is done. So if anyone know any other way to do this, via some events or something similar please add it here...
P.S. Don't use Google Translation API it's Deprecated and will be removed till the end of this year.