Closed AkmalPratama closed 3 years ago
same with me
Same here.
Same here.
Same here.
same
pip install googletrans==4.0.0rc1 this will fix the problem.
Not sure what you mean. The title of issue clearly stated that version
I have the same error, but when the length of string is more than 5 000 characters.
Same problem
Not a fix but I just had a glimpse at the source code and found that
class Translator:
...
def translate(self, text, dest='en', src='auto', **kwargs):
...
if isinstance(text, list):
result = []
for item in text:
translated = self.translate(item, dest=dest, src=src, **kwargs)
result.append(translated)
return result
In other words, it just does a for loop to translate each string in the list if a list is passed in. Since I was looking for ways to speed up my application, I try bulk translation. (I was doing a for loop by myself originally) Now it turns out to me that whether it works or not has really no big deal...... I suggest you write the for loop in your code instead if you need it to work asap while waiting for a fix.
Use this for google translation and it is working fine https://pypi.org/project/pygoogletranslation
Thank me later
Use this for google translation and it is working fine https://pypi.org/project/pygoogletranslation
Thank me later
yours doesn't working either, but that's another issue
AttributeError Traceback (most recent call last)
<ipython-input-69-9b258cdf2b47> in <module>()
1 translator = Translator()
----> 2 translations = translator.translate(['this is google translation', 'Tamil language' ], dest='ta')
3 for translation in translations:
4 print(translation.origin, ' -> ', translation.text)
/usr/local/lib/python3.6/dist-packages/pygoogletranslation/translate.py in translate(self, text, src, dest)
40
41 def translate(self, text, src='auto', dest='en'):
---> 42 text = text.replace('"', '')
43 text = text.replace("'", "")
44
AttributeError: 'list' object has no attribute 'replace'
Hi All,
We have updated our pygoogletranslation package to overcome the below issue,
1) bulk translation list error. 2) Character limit for old translation accept character upto 5000 but this package support unlimited translation 😛
For more information, visit our official pygoogletranslation page or GitHub page
Thanks, Saravananslb
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I had the same issue on 4.0.0-rc1.
To solve it, I reverted back to 3.1.0a0:
python3 -m pip uninstall googletrans==4.0.0-rc1
python3 -m pip install googletrans==3.1.0a0
The following code works:
from googletrans import Translator
translate_list = ['This is a test', 'to see if this', 'works or if I', 'have to continue working']
translator = Translator()
translations = translator.translate(translate_list, dest='sv')
for translation in translations:
print(translation.text)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Same issue here.. trying to bulk translations.
same
same
same issue 😒
Googletrans version:
I'm submitting a ...
Current behavior:
I tried to use the bulk translate from sample code on documentation page. The translate method return error
TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'
Expected behavior:
Should be same as written in documentation page. Bulk translate must return collection of translated object
Steps to reproduce:
Use list of string as an input parameter translate method
Related code:
Other information: