Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknow issue when translate and replace #6153

Open
ledangtuanbk opened this issue Oct 6, 2024 · 5 comments
Open

Unknow issue when translate and replace #6153

ledangtuanbk opened this issue Oct 6, 2024 · 5 comments

Comments

@ledangtuanbk
Copy link

📝 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
Copy link
Owner

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

@ledangtuanbk
Copy link
Author

ledangtuanbk commented Oct 7, 2024

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:

<TITLE>302 Moved</TITLE>

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 YiiGuxing removed the bug 🐛 label Oct 7, 2024
@YiiGuxing
Copy link
Owner

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

@ledangtuanbk
Copy link
Author

It means that

  • I translate to much -> google detects unusual activity -> they block my IP for a few times -> API will return a 302 error code.
    So I think we need to handle 302 error code. The response is not json -> the plugin can not parse json (it's XML) from the response.

@YiiGuxing
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants