背景
Google 翻译退出中国。Google发言人证实了这一点,该公司以“低使用率”为由,终止了中国大陆的Google翻译服务,该变化将影响Chrome浏览器以及KOReader等应用的内置翻译功能。
浏览器访问翻译地址出现
https://translate.google.cn/m
404.That’s an error.
The requested URL /m was not found on thisserver. That’s all we know.
IDEA翻译插件出现报错:
更新 TKK 失败,请检查网络连接
cn.yiiguxing.plugin.translate.trans.NetworkException: connect timed out. host=translate.googleapis.com
at cn.yiiguxing.plugin.translate.trans.NetworkException$Companion.wrapIfIsNetworkException(Exceptions.kt:37)
at cn.yiiguxing.plugin.translate.trans.TKK.updateFromGoogle(TK.kt:82)
at cn.yiiguxing.plugin.translate.trans.TKK.update(TK.kt:53)
at cn.yiiguxing.plugin.translate.trans.TKK.getValue(TK.kt:43)
at cn.yiiguxing.plugin.translate.trans.TKKt.tk$default(TK.kt:100)
at cn.yiiguxing.plugin.translate.trans.GoogleTranslator.getRequestUrl(GoogleTranslator.kt:80)
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate(AbstractTranslator.kt:82)
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:100)
at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:184)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(NativeMethod)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)Caused by:java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.waitForConnect(NativeMethod)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:289)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:203)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1232)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:189)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at com.intellij.util.io.HttpRequests.openConnection(HttpRequests.java:620)
at com.intellij.util.io.HttpRequests$RequestImpl.getConnection(HttpRequests.java:356)
at com.intellij.util.io.HttpRequests$RequestImpl.getInputStream(HttpRequests.java:364)
at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:429)
at com.intellij.util.io.RequestBuilder.lambda$readString$4(RequestBuilder.java:83)
at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:531)
at com.intellij.util.io.HttpRequests.process(HttpRequests.java:513)
at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:332)
at com.intellij.util.io.RequestBuilder.readString(RequestBuilder.java:83)
at cn.yiiguxing.plugin.translate.trans.TKK.updateFromGoogle(TK.kt:66)...18 more
解决
1、管理员方式打开cmd命令
输入 :
nslookup google.cn
C:\Users\Administrator>nslookup google.cn
服务器: public1.114dns.com
Address: 114.114.114.114
非权威应答:
名称: google.cn
Address: 220.181.174.98
Address: xxx.xxx.xx.xx由于 hosts 文件属于系统文件,因此需要用到系统管理员身份。这里推荐【以管理员身份】运行系统自带的“记事本”程序,通过菜单中的【打开】按如下路径打开 hosts
2、修改hosts文件
默认路径
C:\Windows\System32\drivers\etc\hosts
将你所获取到的 IP 和 Google 翻译 API 的域名组合成一条 hosts 规则,并将其添加到 hosts 文件中的最后一行,保存文件后插件即可恢复正常使用。
220.181.174.98 translate.googleapis.com
如果以上方式不行,关注公众号 回复关键字 “代理 ” 领取
点赞 收藏 关注
江南三月烟花笑 痴玩年少之美妙
版权归原作者 三省同学 所有, 如有侵权,请联系我们删除。