Getting fast and accurate transcripts with Deepgram is often just one step in a broader project. We frequently get asked about adding translations to projects once transcripts are returned, and that's what we'll be doing in this project.
There are plenty of translation APIs available to developers, but I've become rather fond of iTranslate after using them in a project earlier this month. It's a fast an straightforward API with a generous free tier and no rate limits at the time of writing.
Before We Start
You will need:
Node.js installed on your machine - download it here.
A Deepgram API Key - get one here.
An iTranslate API Key - get one here.
Create a new directory and navigate to it with your terminal. Run npm init -y to create a package.json file and then install the following packages:
Create a .env file and add the following:
Create an index.js file and add the following to it:
An Introduction to iTranslate
iTranslate supports text translation for over 50 languages. You may either specify the 'source dialect' with a value such as en (English) or es (Spanish), or set the value to auto and let iTranslate detect the language automatically. You must also specify a 'target dialect' for translation to work. An API request would look like this:
The result looks like this:
Create A Translation Function
Add the following to the bottom of your index.js file:
Try it out by adding the following code underneath the translate function:
Run this with node index.js, and you should see the output in your terminal. Once you know it works, delete the line you just wrote.
Pre-Recorded Transcript Translation
To provide transcripts in languages which are different from the source audio, we will first get a transcript with Deepgram. Once the transcript is returned, we will translate the text. An example would look like this:
Live Transcript Translation
iTranslate does not impose a rate limit at the time of writing, so transcribing live results from Deepgram is possible. This example gets live radio data and transcribes it with Deepgram. Once data is returned, we use the translate function:
In Summary
Because iTranslate is such a fast translation service, it is a good pairing with Deepgram's super fast speech recognition API.
If you have any questions, please feel free to reach out on Twitter - we're @DeepgramAI.
If you have any feedback about this post, or anything else around Deepgram, we'd love to hear from you. Please let us know in our GitHub discussions .
Unlock language AI at scale with an API call.
Get conversational intelligence with transcription and understanding on the world's best speech AI platform.