DIY Language Translator API using Node.js and IBM Watson

Shagun Khemka
Jul 29, 2017 · 2 min read
Just an overview

Language translator is indeed a good project for learning Natural-Language-Processing. However it takes time and knowledge about understanding those concepts. So how about leveraging Artificial-Intelligence-as-a-Service for language-translations? Sounds good to me as they provide better accuracy and takes less time to set up. In this short DIY tour let’s know about IBM Watson and how to integrate its functionality with Node.js to create a simple but useful REST API.

But what is IBM Watson? Well it’s an IBM supercomputer that combines artificial intelligence (AI) and sophisticated analytical software for optimal performance as a “question answering” machine. Watson API offers large number of functionality most of which are free. In this tour we would use “language-translator/v2” API for language-translation. This API offers free language translation for 6 languages including Arabic, French, Spanish, Portugese and offers conversions to other languages on paid version.

As the theory part is now complete, lets get our hands dirty. Assuming that you are registered in IBM Bluemix, please receive your credentials for language-translation (found under watson services in Bluemix). The credentials would look like this:-

"url": "",
"username": "USERNAME",
"password": "PASSWORD"

Note:- There is also a Github repository named IBM-Bluemix-Docs provided by IBM themselves for more knowledge not just regarding this but also other functions . You can view for Language-Translation

Moving ahead, now its time for some Javascript :)

First it’s a good practice not to store sensitive credentials in our javascript file but instead store it in a “.env” file. Here i have stored my username and password in a .env file and accessing it using dotenv module.

Then using express as our middleware, we create an API Endpoint /api through which we pass our word to be translate.

Note:-es stands for spanish. This can be changed as per your prefered language.

Also do not forget Hosting in order to access this API.


Thats it folks!! You just created a Language-Translator by your own without having much knowledge on NLP!!

I hope this article was useful. Please like, recommend, leave a response regarding anything about this project.

Link to the project:-

P.S:- Hope i haven’t disappointed you.I am a self-learned,passionate programmer who wants to create stuff which have never been heard,seen or thought of. You can see my other projects at, LinkedIn:-

how hackers start their afternoons.

Shagun Khemka

Written by

A Passionate Innovator

how hackers start their afternoons.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade