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

No translation was found using the current translator. Try another translator? #289

Open
KotDeKennedy opened this issue Feb 9, 2025 · 32 comments · May be fixed by #290
Open

No translation was found using the current translator. Try another translator? #289

KotDeKennedy opened this issue Feb 9, 2025 · 32 comments · May be fixed by #290

Comments

@KotDeKennedy
Copy link

"No translation was found using the current translator. Try another translator?" - the library wrote to me and the code stopped. It started yesterday and continues to this day.

Code snippet:

# Text translation function from Russian to English
def translate_to_english(text):
return Google Translator(source='ru', target='en').translate(text)

# The function of translating text from English to Russian
def translate_to_russian(text):
return GoogleTranslator(source='en', target='ru').translate(text)

Is the library not working only for me? I looked at it, it's the same on all devices and on all translators. At first, there was a feeling that Google was covering up the requests with a good curse and sending them to hell. But it turned out that others don't work either, like "MyMemoryTranslator". I do not deny that it could have been done by my authorities or sanctions, since I am from Russia. But individually, all the translators in the browser are working and the connection with them is stable. DPI is also missing. (just don't kick me, I don't know anything about networking.)

Please help me :(

@EmirhanSyl
Copy link

Same problem for me. I tried to translate "Hello" text from 2 different IP and devices but result is the same. Before this happens, I was getting really bad translations. IG something wrong with the package for 2-3 days.

@bmtuan
Copy link

bmtuan commented Feb 10, 2025

Same for me. I've tried many times but i got the same result. "No translation was found using the current translator. Try another translator?"

@NikitaV0V
Copy link

Нихрена не работает, вчера вообще перестало работать. Сегодня вернулось - но всё такой же дословный перевод, как и до "отключения"

@NikitaV0V
Copy link

My problem was solved, what about yours?

@EmirhanSyl
Copy link

Mine solved too. Hopefully it doesn't repeat again

@tuzibr
Copy link

tuzibr commented Feb 14, 2025

I am currently facing this issue as well, and I am using Google Translate.

@zeyund
Copy link

zeyund commented Feb 14, 2025

same prob google engineers xd, no longer WLB

@inklaar
Copy link

inklaar commented Feb 14, 2025

I'm just getting "Error 500 (Server Error)!!1500.That’s an error.There was an error. Please try again later.That’s all we know." in a function that had been running well for a year.

Previous days this happened intermittently, now it's constant.

@EmirhanSyl
Copy link

I'm just getting "Error 500 (Server Error)!!1500.That’s an error.There was an error. Please try again later.That’s all we know." in a function that had been running well for a year.

Previous days this happened intermittently, now it's constant.

This is the same issue with previous one(3 days ago). Its not about with the package but the google.

xpz3 added a commit to xpz3/deep-translator that referenced this issue Feb 15, 2025
@xpz3 xpz3 linked a pull request Feb 15, 2025 that will close this issue
@xpz3
Copy link

xpz3 commented Feb 15, 2025

Try this #290

@Neko-Kuroi
Copy link

OK
"Error 500 (Server Error)!!1500.That’s an error.There was an error. Please try again later.That’s all we know." problem

onetime instant patch

ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) \
      AppleWebKit/537.36 (KHTML, like Gecko) \
      Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.81" # example
#----- ----- ----- -----
import requests
from requests import Session

# Save the original send method
_original_send = Session.send

def _patched_send(*args, **kwargs):
    """
    Patched send method that automatically adds User-Agent header
    """
    # Get the request object
    request = args[1]
    
    # Set default User-Agent if not provided
    if 'User-Agent' not in request.headers:
        request.headers['User-Agent'] = DEFAULT_USER_AGENT
    
    # Call original send method
    return _original_send(*args, **kwargs)

# Default User-Agent string
DEFAULT_USER_AGENT = ua

def apply_patch(user_agent=None):
    """
    Apply User-Agent patch to requests
    
    :param user_agent: Custom User-Agent string (optional)
    """
    global DEFAULT_USER_AGENT
    if user_agent:
        DEFAULT_USER_AGENT = user_agent
        
    # Apply patch only if not already applied
    if Session.send != _patched_send:
        Session.send = _patched_send

def remove_patch():
    """Restore original send method"""
    if Session.send == _patched_send:
        Session.send = _original_send

# Apply patch automatically when module loads (optional)
apply_patch()
#----- ----- ----- -----

@zeyund
Copy link

zeyund commented Feb 15, 2025

it seems like this issue is still here, anyone how to solve it or pull request?

@xpz3
Copy link

xpz3 commented Feb 15, 2025

it seems like this issue is still here, anyone how to solve it or pull request?

I have been testing this for 5 to 6 hours and the patch works for me. Removing the patch immediately shows the error. I've also tested bulk text translation

@Neko-Kuroi
Copy link

fixed?
I got no erorr message with no onetime patch.

@xpz3
Copy link

xpz3 commented Feb 15, 2025

fixed? I got no erorr message with no onetime patch.

I did the patch for google translate only and your patch does the same for all reqs. This should fix the error

@Neko-Kuroi
Copy link

there is no error messages.
very good.

@zeyund
Copy link

zeyund commented Feb 15, 2025

there is no error messages. very good.

hello where should we edit for the patch part? may i know the path for the locaiton?

@Neko-Kuroi
Copy link

Neko-Kuroi commented Feb 15, 2025

there is no error messages. very good.

hello where should we edit for the patch part? may i know the path for the locaiton?

Maybe it has already patched by xpz3.

problem is(was) Google server wants browser's User-Agent infomation.So we need add headers to requests.get() .

If it is not fixed ... example

Just example
It is not correct.Conceptual example

from deep_translator import GoogleTranslator
import requests

class CustomUserAgentGoogleTranslator(GoogleTranslator):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Custom Agent)',  # Custom User-Agent
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
        }

    def translate(self, text, **kwargs):
        # Original parameter generation logic
        url = "https://translate.google.com/translate_a/single"
        params = self._prepare_params(text)
        
        # Execute request (apply custom headers)
        response = requests.get(
            url,
            params=params,
            headers=self.headers,  # Specify custom headers
            proxies=self.proxies,
            timeout=self.timeout
        )
        
        # Response processing
        return self._parse_response(response.text)

# Example usage
translator = CustomUserAgentGoogleTranslator(source='en', target='ja')
print(translator.translate("hello"))

@xpz3
Copy link

xpz3 commented Feb 15, 2025

there is no error messages. very good.

hello where should we edit for the patch part? may i know the path for the locaiton?

Goto your deep translator location and find the file google.py. open a terminal in that folder. Then apply this patch by running
patch -p1 < 3d2af63ea43d44eb19473e056a0716c2687d0fdd.patch
Download the patch here
If you cannot find the location, you can run deep translator and the error will show you the path to the installation.

@EmirhanSyl
Copy link

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

@xpz3
Copy link

xpz3 commented Feb 16, 2025

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

@TirelessHunter1
Copy link

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:

translate.google.com:
Ko: 엑스칼리버 뽑습니다
En: Pull out Excalibur.

Translate.google.com/m:
Ko: 엑스칼리버 뽑습니다
En: Excalibur.

@xpz3
Copy link

xpz3 commented Feb 18, 2025

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:

translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.

Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script

This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=True, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

@cerega66
Copy link

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:
translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.
Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script

This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=False, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

I tried your web script directly from your fork. If used with headless=False, the translation is high-quality, but 3 seconds to wait may not be enough, and with each request a new chrome window opens and as a result, there are dozens of them after a while.

With headless=True, the translation is still bad, and with each request a process opens in the background that then does not close and as a result, after a while, either the memory or the CPU is filled.

@xpz3
Copy link

xpz3 commented Feb 19, 2025

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:
translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.
Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script
This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=False, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

I tried your web script directly from your fork. If used with headless=False, the translation is high-quality, but 3 seconds to wait may not be enough, and with each request a new chrome window opens and as a result, there are dozens of them after a while.

With headless=True, the translation is still bad, and with each request a process opens in the background that then does not close and as a result, after a while, either the memory or the CPU is filled.

#283 (comment) i used the Japanese text from this post and with both headless and gui mode i get the same translation. The translation is only different when using apis. I'll look into the the process not getting closed. And yes 3 seconds may not be enough on some systems. That's why i left the comment.

@xpz3
Copy link

xpz3 commented Feb 19, 2025

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:
translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.
Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script
This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=False, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

I tried your web script directly from your fork. If used with headless=False, the translation is high-quality, but 3 seconds to wait may not be enough, and with each request a new chrome window opens and as a result, there are dozens of them after a while.

With headless=True, the translation is still bad, and with each request a process opens in the background that then does not close and as a result, after a while, either the memory or the CPU is filled.

Quick question, did you forget translator.close() after translation?

@cerega66
Copy link

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:
translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.
Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script
This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=False, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

I tried your web script directly from your fork. If used with headless=False, the translation is high-quality, but 3 seconds to wait may not be enough, and with each request a new chrome window opens and as a result, there are dozens of them after a while.
With headless=True, the translation is still bad, and with each request a process opens in the background that then does not close and as a result, after a while, either the memory or the CPU is filled.

Quick question, did you forget translator.close() after translation?

Whops, my bad. Now is work fine. But anyway in headless i get a bad translation. I translate from English to other languages ​​and this is what I get.

Original: How can I help you today?

In headless:
japanese: 今日はどうすればお手伝いできますか?
Russian: Как я могу вам помочь сегодня?
German: Wie kann ich Ihnen heute helfen?
French: Comment puis-je vous aider aujourd'hui?

Not headless:
japanese: 今日はどのようなご用件でしょうか?
Russian: Чем я могу вам помочь сегодня?
German: Wie kann ich Ihnen heute helfen?
French: Comment puis-je vous aider aujourd'hui?

As you can see, the translation is different. The second case is more correct and corresponds to the translation from the site. If you make longer sentences, you get the feeling that it translates phrases of 3-4 words, and not the entire sentence or text as a whole.

@xpz3
Copy link

xpz3 commented Feb 19, 2025

The issue is fixed but the translation quality is still not so promising for me. Is there anyone who has the same issue?

What's wrong with quality? It's the same translation that you get on website. Are you saying that the translations are different on translate.google.com and translate.google.com/m ?

Yeah, until a few days ago there were no changes in quality, but now there are... The quality is significantly worse compared to the website. For example:
translate.google.com: Ko: 엑스칼리버 뽑습니다 En: Pull out Excalibur.
Translate.google.com/m: Ko: 엑스칼리버 뽑습니다 En: Excalibur.

Try this translate.google.com Web Translation Script
This would not be as fast as the other api

# Requirement: pip3 install setuptools selenium undetected-chromedriver 
#Example usage
#driver_wait is the time set to load the webpage fully. If set to zero may end up in no translation found error.

translator = GoogleTranslatorWeb(headless=False, driver_wait=3)

text = "Hello"
translated = translator.translate(text, source_lang="auto", target_lang="es")
print(f"Translated: {translated}")
translator.close()

I tried your web script directly from your fork. If used with headless=False, the translation is high-quality, but 3 seconds to wait may not be enough, and with each request a new chrome window opens and as a result, there are dozens of them after a while.
With headless=True, the translation is still bad, and with each request a process opens in the background that then does not close and as a result, after a while, either the memory or the CPU is filled.

Quick question, did you forget translator.close() after translation?

Whops, my bad. Now is work fine. But anyway in headless i get a bad translation. I translate from English to other languages ​​and this is what I get.

Original: How can I help you today?

In headless: japanese: 今日はどうすればお手伝いできますか? Russian: Как я могу вам помочь сегодня? German: Wie kann ich Ihnen heute helfen? French: Comment puis-je vous aider aujourd'hui?

Not headless: japanese: 今日はどのようなご用件でしょうか? Russian: Чем я могу вам помочь сегодня? German: Wie kann ich Ihnen heute helfen? French: Comment puis-je vous aider aujourd'hui?

As you can see, the translation is different. The second case is more correct and corresponds to the translation from the site. If you make longer sentences, you get the feeling that it translates phrases of 3-4 words, and not the entire sentence or text as a whole.

Ill test the same text and get back later today.

@am1guard
Copy link

Is there still no solution to the problem?

@zeyund
Copy link

zeyund commented Feb 26, 2025

i think the issue is now fixed, but the quality of the translation is still bad, I am experiencing the same issue where the google translation only translate a few words and stop, this will make the whole paragraph no sense

@xpz3
Copy link

xpz3 commented Feb 26, 2025

I'm trying out various methods in hope to find a fix. One of them looks good and almost always gets the original translation from translate.google.com. doing more tests before confirming. Its a bit slow though..

@xpz3
Copy link

xpz3 commented Feb 26, 2025

i think the issue is now fixed, but the quality of the translation is still bad, I am experiencing the same issue where the google translation only translate a few words and stop, this will make the whole paragraph no sense

Can you provide an example of such long sentence and the source and translation languages?

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

Successfully merging a pull request may close this issue.