Skip to content
← Back to Community
Language Whatifyer
Profile icon
SixBeeps

I was inspired by a post from @userSM that demonstrated how to translate a file's contents using the googletrans package. When I saw it, I was almost immediately reminded of a project I like to make with Google Translate, called a "Language Whatifyer". Essentially, it takes in a string, then translates it through a chain of randomly-selected languages. At the end, it does a final translation back into English and prints out the result. The goal here is that there are some translation inaccuracies which will deform the meaning of the sentence through each translation, which is quite common with translation services.

Voters
Profile icon
programmeruser
Profile icon
Soccer135246
Profile icon
Spacecraft
Profile icon
Bookie0
Profile icon
DynamicSquid
Profile icon
SixBeeps
Comments
hotnewtop
Profile icon
DynamicSquid

Error!

line 11 in <module> 'module' object is not callable
Profile icon
SixBeeps

@DynamicSquid Thanks for catching that, I forgot I had progressbar2 installed on my local runner :p

Profile icon
Soccer135246

Enter a short phrase: hi buddy
Could not translate to Hebrew
Could not translate to Swedish
Could not translate to Punjabi
Could not translate to Luxembourgish
Could not translate to Czech
Could not translate to Basque
Could not translate to Sindhi
Could not translate to Chinese (Simplified)
Traceback (most recent call last):
File "main.py", line 20, in
instr = trans.translate(instr, 'en').text
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/client.py", line 182, in translate
data = self._translate(text, dest, src, kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/client.py", line 78, in _translate
token = self.token_acquirer.do(text)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/gtoken.py", line 194, in do
self._update()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/gtoken.py", line 62, in _update
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

uhhhh... ?

Profile icon
SixBeeps

@Soccer135246 Probably an update in the googletrans library that I didn't catch, not gonna check it out though since this project is two years old and hardly anyone uses it.

Profile icon
Soccer135246

@SixBeeps come on, this is actually good tho

Profile icon
Bookie0

Screen Shot 2020-08-18 at 6.08.45 PM

lmaoo wut

Profile icon
SixBeeps

@Bookie0 Yeah she's the mother.

Profile icon
Bookie0
Profile icon
userSM

Nice