YiiGuxing / TranslationPlugin

Translation plugin for IntelliJ based IDEs/Android Studio.
https://intellij-translation.yiiguxing.top
MIT License
11.26k stars 784 forks source link

Unknow issue when translate and replace #6153

Open ledangtuanbk opened 6 days ago

ledangtuanbk commented 6 days ago

📝 Issue Description

I got an error when translate and replace image

🏷 Plugin Version

3.6.6

🔁 Translation Engine(s)

Google Translate

💻 IDE and Operating Environment

IntelliJ IDEA 2024.1.6 (Ultimate Edition)
Build #IU-241.19072.14, built on August 8, 2024
Licensed to Trang Vu
Subscription is active until June 22, 2025.
For educational use only.
Runtime version: 17.0.11+1-b1207.30 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.8.0-45-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 4004M
Cores: 8
Registry:
  ide.experimental.ui=true
Non-Bundled Plugins:
  Key Promoter X (2024.2.0)
  google-java-format (1.23.0.0)
  VisualVMLauncher (1.23.1-IJ2023.3)
  String Manipulation (9.14.1)
  gherkin (241.17011.40)
  cucumber-java (241.14494.158)
  com.github.copilot (1.5.24.6840)
  cn.yiiguxing.plugin.translate (3.6.6)
Kotlin: 241.19072.14-IJ
Current Desktop: ubuntu:GNOME

📋 Stacktrace

No response

YiiGuxing commented 6 days ago

Have you retried, and is the issue still the same?

ledangtuanbk commented 6 days ago

It's caused by response from Google Translate. I think we should catch the message and response correctly when they detect abnormal traffic ` 2024-10-06 08:16:36,376 [ 19796] INFO - #cn.yiiguxing.plugin.translate.trans.google.GoogleTranslator - Translate result:

302 Moved

302 Moved

The document has moved here. 2024-10-06 08:16:36,385 [ 19805] SEVERE - #cn.yiiguxing.plugin.translate.trans.AbstractTranslator - IdeaLoggingEvent[message=Translation parsing failed[translate.google]: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $, throwable=cn.yiiguxing.plugin.translate.diagnostic.ReportException: Translation parsing failed[translate.google]: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ at cn.yiiguxing.plugin.translate.trans.TranslateClient.investigate(TranslateClient.kt:85) `
YiiGuxing commented 5 days ago

Unable to correctly recognize the contents of the error returned by the service.

ledangtuanbk commented 5 days ago

It means that

YiiGuxing commented 5 days ago

I'm not sure if the API is returning a 302 status code. Can you confirm this for me?