deep-translator icon indicating copy to clipboard operation
deep-translator copied to clipboard

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

Open KotDeKennedy opened this issue 10 months ago • 33 comments

"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 :(

KotDeKennedy avatar Feb 09 '25 21:02 KotDeKennedy

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.

EmirhanSyl avatar Feb 10 '25 11:02 EmirhanSyl

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?"

bmtuan avatar Feb 10 '25 13:02 bmtuan

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

NikitaV0V avatar Feb 10 '25 14:02 NikitaV0V

My problem was solved, what about yours?

NikitaV0V avatar Feb 11 '25 14:02 NikitaV0V

Mine solved too. Hopefully it doesn't repeat again

EmirhanSyl avatar Feb 11 '25 14:02 EmirhanSyl

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

tuzibr avatar Feb 14 '25 13:02 tuzibr

same prob google engineers xd, no longer WLB

zeyund avatar Feb 14 '25 15:02 zeyund

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.

inklaar avatar Feb 14 '25 21:02 inklaar

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.

EmirhanSyl avatar Feb 14 '25 22:02 EmirhanSyl

Try this https://github.com/nidhaloff/deep-translator/pull/290

xpz3 avatar Feb 15 '25 01:02 xpz3

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()
#----- ----- ----- -----

Neko-Kuroi avatar Feb 15 '25 06:02 Neko-Kuroi

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

zeyund avatar Feb 15 '25 08:02 zeyund

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

xpz3 avatar Feb 15 '25 08:02 xpz3

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

Neko-Kuroi avatar Feb 15 '25 09:02 Neko-Kuroi

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

xpz3 avatar Feb 15 '25 09:02 xpz3

there is no error messages. very good.

Neko-Kuroi avatar Feb 15 '25 12:02 Neko-Kuroi

there is no error messages. very good.

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

zeyund avatar Feb 15 '25 13:02 zeyund

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"))

Neko-Kuroi avatar Feb 15 '25 14:02 Neko-Kuroi

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.

xpz3 avatar Feb 15 '25 20:02 xpz3

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

EmirhanSyl avatar Feb 15 '25 21:02 EmirhanSyl

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 ?

xpz3 avatar Feb 16 '25 09:02 xpz3

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.

TirelessHunter1 avatar Feb 18 '25 01:02 TirelessHunter1

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()

xpz3 avatar Feb 18 '25 06:02 xpz3

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.

cerega66 avatar Feb 19 '25 16:02 cerega66

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.

https://github.com/nidhaloff/deep-translator/issues/283#issue-2837411545 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 avatar Feb 19 '25 18:02 xpz3

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?

xpz3 avatar Feb 19 '25 18:02 xpz3

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.

cerega66 avatar Feb 19 '25 18:02 cerega66

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.

xpz3 avatar Feb 19 '25 18:02 xpz3

Is there still no solution to the problem?

am1guard avatar Feb 23 '25 15:02 am1guard

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

zeyund avatar Feb 26 '25 06:02 zeyund