Java Swing项目中的Google音译API [英] Google transliteration API in Java Swing project
问题描述
我正在使用Java Swing进行音译项目.它可以访问互联网,但是我无法设置它.我们该怎么做?我们需要下载Google API库还是只是一个函数调用就可以?
I'm working on a transliteration project in Java Swing. It can access the internet, but I'm unable to set it up. How do we do that? Do we need to download the Google API libraries or just a function call will do?
以下是一些有用的音译链接:
Here are some useful Transliteration links:
(我认为它具有Google的所有API库:翻译,音译,搜索等)
(I think it has all API libraries of Google:Translate, transliterate, search, etc.)
我花了很多时间,但我什至没有找到如何设置音译API的方法.
I spent a lot of time, but Icouldn't find how to set up the Transliteration API, not even at SO.
推荐答案
似乎音译API已被弃用,并且不包含在Java客户端中,仅包含在JavaScript客户端中.
Seems the transliteration API is deprecated and is not included in the Java client, only in the JavaScript client.
JS库进行的实际调用非常简单,可以轻松地从任何地方复制:
The actual calls the JS library makes are pretty simple and could easily be replicated from anywhere:
http://www.google.com/inputtools/request?ime=transliteration_en_ru&num=5&cp=0&cs=0&ie=utf-8&oe=utf-8&text=prosto
不过,不知道这样做是否违反Google的条款.可能是.
Don't know if doing that is against Google's terms, though. Probably it is.
您还可以尝试在 Rhino 中运行Ajax客户端.您将需要提供纯JavaScript DOM环境的 env-js .
You could also try running the Ajax client in Rhino. You'll need env-js which provides a pure javascript DOM environment.
这太可怕了,无法正常工作!
It's just hideous enough to work!
这篇关于Java Swing项目中的Google音译API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!