idea 版本:2019.3.3
Translation版本:v2.9.3-193
错误截图:
错误日志:
>Plugin v2.9.3-193
>IntelliJ IDEA 2019.3.3
>Build #IU-193.6494.35, built on February 11, 2020
>Runtime version: 11.0.5+10-b520.38 amd64
>VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
>OS: Windows 10 10.0```
cn.yiiguxing.plugin.translate.trans.TranslateException: Google Translate :: 翻译失败: 网络连接超时,请检查网络连接at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:101)at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:186)at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)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.lang.Thread.run(Thread.java:834)
Caused by: cn.yiiguxing.plugin.translate.trans.NetworkException: connect timed out. host=translate.googleapis.comat cn.yiiguxing.plugin.translate.trans.NetworkException$Companion.wrapIfIsNetworkException(Exceptions.kt:37)at cn.yiiguxing.plugin.translate.trans.GoogleTranslator.onError(GoogleTranslator.kt:117)at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.access$onError(AbstractTranslator.kt:18)... 8 more
Caused by: java.net.SocketTimeoutException: connect timed outat java.base/java.net.PlainSocketImpl.waitForConnect(Native Method)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:403)at java.base/java.net.Socket.connect(Socket.java:609)at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:285)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:191)at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1227)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:177)at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1362)at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1337)at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:246)at com.intellij.util.io.HttpRequests$Request.write(HttpRequests.java:118)at com.intellij.util.io.HttpRequests$Request.write(HttpRequests.java:112)at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$doTranslate$2.process(AbstractTranslator.kt:74)at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$doTranslate$2.process(AbstractTranslator.kt:18)at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:518)at com.intellij.util.io.HttpRequests.process(HttpRequests.java:500)at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:56)at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:350)at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate(AbstractTranslator.kt:73)at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:80)... 7 more
```
解决方式:
解决思路:
无论你的插件有没有translate.google.com这个选项,只要看你的日志,他是访问的哪个域名,
把hosts指向translate.google.cn这个域名就可以了 .cn是国内的域名 一定可以访问到
hosts:
效果: