We can use a language translator to translate text from one language to another.
There are various APIs and modules for this, we’ll use the Google Translate API.

We will use the Goslate module to translate. Apart from translation, it supports
language detection, batch translation, dictionary lookup and more.

You may like: Natural Language Processing with Deep Learning in Python


The goslate module connects with the Google Translate API.
The first step is to install the goslate module.
Install goslate using pyenv, pipenv or virtualenv.


With just a few lines of code we can translate English to French.

Change the second parameter in gs.translate to alter the language.

Other Translate APIs

There are a few other translation APIS including:

Do you know of any other modules? leave a comment.


If there is no module available for the translation API,
you could make your own module using beautifulsoup.

Offline Translation

This is a simple dictionary translation (offline). If you want a simple word translation, you can use this.Use your package manager to install dictd,

Then to list databases

To translate a single word:

We create this code to list all translations:


Previous Post
Next Post


Leave a Reply