How to use Machine Translation API with JavaScript in 5 minutes?
Tags: translation, api, ai, javascript
Published: 2023-01-11 15:17:45

*In this tutorial, you will learn how to use Automatic Translation API in 5 minutes using JavaScript. Eden AI provides an easy and developer-friendly API that allows you to translate your texts.*

## **What is Automatic Translation?**

‍[Machine Translation](https://www.edenai.co/technologies/translation?referral=how-to-translation-javascript), also known as Automatic Translation, is the process of translating text from one language to another without human involvement.

Translation is becoming increasingly important for businesses that have products or applications used by a global audience. These translated texts are often used with other Natural Language Processing tools such as [Sentiment Analysis](https://www.edenai.co/feature/sentiment-analysis?referral=how-to-translation-javascript), [Keyword Extraction](http://www.edenai.co/feature/keyword-extraction?referral=how-to-translation-javascript), or [Text Summarization](https://www.edenai.co/feature/summarization?referral=how-to-translation-javascript).

Developers often need to create websites that can translate text into multiple languages. Eden AI's Automatic Translation API allows for quick translation of a text into another language, with a simple interface for dynamic translation of any supported language. It can also be used to identify the language of a text when the source language is unknown.

**[Try these APIs on Eden AI](https://app.edenai.run/user/register?referral=how-to-translation-javascript)**
‍
## **Getting Started with Automatic Translation API**

The first step to using Automatic Translation API is to set Axios, a promise-based HTTP client for the browser and Node.js, that will allow you to call Eden AI API.

![https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/638f08881993bd518d9ca0cc_carbon(3).png](https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/638f08881993bd518d9ca0cc_carbon(3).png)

## **How to use Automatic Translation API with JavaScript**

You are now ready to process text into Eden AI Automatic Translation API in many languages with different providers. You can access the list of languages supported [here](https://docs.edenai.co/reference/translation_automatic_translation_create?referral=how-to-translate-python).

### **1. Get an Automatic Translation API Key on Eden AI**

To perform Automatic Translation, make sure to create an account on [Eden AI](https://app.edenai.run/user/register?referral=how-to-translation-javascript) for free. Then, you will be able to get your **API key** direclty from the homepage with free credits offered by Eden AI.

![Eden AI platform - Get your API key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/buzp5173pho0pj602y42.png)
**[Get your API key for FREE](https://app.edenai.run/user/register?referral=how-to-translation-javascript)**

### **2.Start translating with Eden AI API Key**

Now that you have initialized the required JavaScript modules and got your API key, it's time to translate your text. With Eden AI, you can choose from a range of different engines you want for Automatic Translation. To help you choose the best provider according to your needs and type of project, you can read our [list of Automatic Translation providers.](https://docs.edenai.co/reference/translation_automatic_translation_create?referral=how-to-translate-python)

For instance, here we have called two different Automatic Translation engines. Here is the JS code to configure the request:

![https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/639060ddf1ad11df1fef1e75_carbon(24).png](https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/639060ddf1ad11df1fef1e75_carbon(24).png)

Then, you just need to launch the request and print the result:

![https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/638f6d1e1a7e8a83944abff6_carbon(16).png](https://uploads-ssl.webflow.com/61e7d259b7746e3f63f0b6be/638f6d1e1a7e8a83944abff6_carbon(16).png)

Here is an example of a Automatic Translation response:

![Machine Translation API with JavaScript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qo599lja8kjrw21sogq2.png)

## Benefits of using Automatic Translation API with Eden AI

As you can see, using Automatic Translation with Eden AI API is quick and easy.

![Best Automatic Translation AIs in one API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iffaefq52rh5lz371h1a.gif)

### Save time and cost

We offer a unified API for all providers: simple and standard to use, with a quick switch between providers and an access to the specificic features of each provider

### Easy to integrate

The JSON output format is the same for all suppliers thanks to Eden AI's standardisation work. The response elements are also standardised thanks to Eden AI's powerful matching algorithms.

### Extensive language coverage

Eden AI aggregates the best Machine Translation APIs of the market: engines dedicated for different languages like English (US, GB, ETC.), Chinese (trad, off, etc), European languages, Afrikaans languages, Asian languages, and other rare languages.


### Customization

With Eden AI you have the possibility to integrate a third party platform: we can quickly develop connectors. To go further and customize your Machine Translation request with specific parameters, check out our [documentation](https://docs.edenai.co/reference/translation_automatic_translation_create?referral=how-to-translate-python).

**[Create your Account on Eden AI](https://app.edenai.run/user/register?referral=how-to-translation-javascript)**