Python 3 Google Translate API Example to Translate Text in All Languages For FREE in Terminal
410 views
Jun 3, 2025
Get the full source code of application here: https://gist.github.com/gauti123456/c80172f35fa6efc6b0893e1d78c71185
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you a very
0:04
important or very free Python package
0:07
which integrates the functionality of
0:09
Google translate which allows you to
0:11
translate from one language to another
0:14
in seconds and the nice thing is that it
0:17
doesn't use any API key it actually
0:19
integrates with the Google translate
0:22
unlimited for free so the package name
0:25
is translate if you go to the Python
0:28
package website
0:31
py pi o rg this is their package manager
0:35
here you can search for third party
0:37
packages so one such package is this
0:40
translate if you just write this the
0:41
very first package which comes right
0:44
here translate uh the command is simple
0:47
simply install this to install this
0:49
package and I have already installed it
0:52
and
0:53
uh it can even be used in
0:56
the CLI as well you can directly use it
1:00
specify the language specify your
1:03
sentence so as I execute this command
1:05
here translate
1:07
CLI I want to convert this into this
1:10
Chinese language you will see in the
1:12
double quotes you provide and you can
1:14
see translation is ready you can do it
1:17
in command line you can see that here
1:20
you can provide any language code so
1:23
this is FR is for French so this is
1:26
English to French enter and then it will
1:30
give the translation to
1:32
you and then we can even do this
1:34
programmatically as well so I've written
1:36
this Python script so you can specify
1:40
any message here in any language let's
1:42
suppose I specify welcome to the world
1:45
of programming so this is a simple
1:48
English sentence right here i just
1:51
created this array which contains all
1:53
the languages code right here so now
1:55
what happens as I execute this Python
1:57
script it will one by one it will give
2:00
the translations to me in each and every
2:02
language so you can see one by one it is
2:06
this is
2:08
African one by one as I'm executing the
2:12
script here it is giving the
2:14
translations in each native language of
2:16
the world so this is similar to Google
2:19
translate and you can just see here how
2:22
awesome is this package here each
2:25
language is giving you a translation so
2:28
I've given the script in the description
2:30
of this video so now let me show you how
2:32
to build this so first of all you just
2:35
need to import this package from
2:37
translate we need to import the method
2:40
here which is translator after that we
2:43
specify the sentence that we need to
2:45
translate
2:47
here you can specify any sentence
2:51
here and then here we
2:54
specify the language quotes so this you
2:58
can go get in the description i have
3:01
given all the script here so specify all
3:04
the language codes here in the world so
3:07
twoletter digit language code so we
3:09
specify all the languages
3:13
codes after that we simply will run the
3:17
for loop
3:19
here in the try catch block here we
3:22
specif we will run this
3:26
service translator and we
3:29
specify translator and here we specify
3:32
the language two language which language
3:35
we want to translate and then this fun
3:39
uh method this module contains this
3:42
function translate and here we specify
3:45
which text we need to translate so we
3:47
specify text to
3:49
translate and uh after we do this we
3:53
will simply give a notification to the
3:54
user that the translation is done so
3:57
simply print out this line right here if
4:00
any sort of error take place you can
4:02
specify this accept
4:05
block so that's all the Python script
4:08
guys even
4:09
see very simple Python script and
4:15
uh if I just you can do this unlimited
4:19
number of time guys this is the thing
4:21
about this package it's a free
4:23
open-source package you can see now it
4:25
is translating this English sentence to
4:27
each and every language in real
4:30
time so you can build out any sort of
4:32
API or web application relating using
4:35
this package in Python or in any
4:37
language
4:38
So I just wanted to show this uh free
4:42
open-source Python package which
4:44
integrates Google Translate
4:46
API very easily and uh thank you very
4:50
much for watching this video and also
4:52
check out my website freemediatools.com
4:55
uh which contains thousands of tools
#Programming
#Scripting Languages