Python 3 googletrans Example to Use Google Translate API to Translate Text For Unlimited For FREE
440 views
Jun 3, 2025
Get the full source code of application here: https://gist.github.com/gauti123456/058890eb3f8b016cacfe8fa52c33295d
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you yet
0:03
another Google translate package inside
0:06
Python which integrates the
0:08
functionality of Google translate API
0:10
without any API key you can
0:13
translate sentences from one language to
0:15
another unlimited number of times so
0:18
this is actually the package in Python
0:19
let me show you if you go to the website
0:22
py this is the third party packages
0:25
searching website for Python just search
0:27
for the package here google
0:31
Trans here and unofficial Google
0:34
Translate API for Python and the command
0:37
is simple you simply install this i've
0:40
already installed it so you can see it's
0:44
compatible with the Python 3.8 plus
0:47
versions so you should have at least 3.8
0:50
versions and you can see you can make
0:53
unlimited number of calls to the Google
0:55
Translate API using this package
0:59
so I have written the script here i've
1:01
given the script in the description of
1:03
the video
1:09
so I've written a sentence in English
1:12
language here you can see and now I will
1:14
be translating to all the languages that
1:16
Google translate support one by one so
1:19
as I execute the script here python app
1:22
py so now what you will see it will
1:25
actually one by one go to all the
1:27
languages in the world and it is giving
1:29
me the translations of this sentence
1:31
that I written right here one by one so
1:34
with the help of this package here you
1:36
can see that all the languages that
1:38
Google translate supports so I've
1:40
written a simple for loop and it is
1:43
going one by one to each of the
1:45
languages and giving me the translations
1:48
so this is actually the module now let
1:51
me show you how to build this so just
1:55
create a simple Python script and just
1:57
first of all import the package from
1:59
Google trans you just need to import the
2:02
translator and also the
2:05
languages so this gives you all the
2:07
languages of Google translate
2:10
API and here you specify which text you
2:14
want to
2:16
translate you can just do it it can be a
2:19
file it can be a sentence for the time
2:21
being I'm just taking a simple example
2:23
hello how are you and then we simply run
2:26
a for loop and
2:30
uh this languages constant gives us the
2:34
array here it will loop through all the
2:36
languages one by one and inside this try
2:41
catch try except block so we will use
2:45
this service translator
2:50
and then it actually contains this
2:52
function translate this package and here
2:56
you specify which text you want to
2:58
translate so text to translate and the
3:01
second argument here will be the source
3:05
language the sentence is in English
3:08
language and then the destination is we
3:10
need to specify language
3:13
code so it is running in the loop here
3:16
so one by one it is execute this so
3:19
after translating it we will give a
3:21
notification to the user that your
3:23
sentence has been translated if any sort
3:26
of error take place then we will also
3:28
have the accept block which will give
3:31
you the error that's all that we need to
3:33
do here the script is complete you
3:36
specify the sentence that you want to
3:38
translate and then we loop through all
3:39
the
3:40
languages so if you execute now the
3:45
thing is that you can do it unlimited
3:46
number of times so there is no kind of
3:48
restriction out
3:51
there so it is saying that translator is
3:54
not defined sorry we need to specify I
3:58
think we haven't yeah so we need to
4:02
initialize this translator engine so
4:06
just specify in this variable so we
4:09
initialize it and now we can simply run
4:13
this so as you can see it will again
4:16
start translating in each of the
4:21
languages so this is actually the module
4:23
guy i personally like it because uh it
4:26
doesn't require you to sign up for any
4:28
sort of Google translate API you can use
4:30
it for completely free unlimited number
4:32
of time and with this you can build any
4:35
sort of application as well
4:37
so also check out my website which is
4:40
freemediattools.com
4:42
uh which contains thousands of tools
#Internet & Telecom
#Web Services