Product · · 7 min read

Real-time message translation for chat apps

Real-time chat translation reduces language barriers and improves global communication. Learn how to set up real-time message translation for your site or app with TalkJS.

A collage with people sending messages saying 'Hey, how are you?' in 15 different languages.

Real-time message translation allows you to have a fluent conversation, regardless of what language the person you’re chatting with speaks. A study by CSA Research shows that 65% of respondents prefer content that’s in their own language, and 75% are more likely to purchase from a brand if it offers localized customer care. In sectors such as international marketplaces, global customer support, education, healthcare, shipping and logistics, and of course travel and tourism, a real-time translator enables frictionless communication. By removing the need for any laborious process of manual translation, live chat translation offers users a better experience, and allows you to operate across languages while saving costs and time.

A simple repeating animation showing a chat message in English, with a toggle to translate the conversation into Chinese. The current user clicks the toggle, and the message is shown in Chinese. The toggle now states that it’s been translated by Google, and offers the option to show the message in the original language.

TalkJS chat offers both chat UI localization and automatic real-time message translation. Powered by the Google Cloud Translation API, it supports 36 languages. In this guide, researcher and technical writer Chris Meyns outlines the core use cases and benefits of real-time message translation with a chat API, how to set up translation in your TalkJS chat, and outlines pricing options.

💡
Want to try things out immediately? Check out the Playground on the live demos page.

Contents

Use cases

Whether you’re offering 1-1 chat, large group chat, or conversations involving AI chatbots, there's a range of relevant use cases for a real-time language translator. Here are some real-world examples.

Customer support

Real-time message translation allows you to scale and simplify your customer support, to serve users worldwide. For example, if you’re running an international online marketplace based in Brazil, you’ve likely set your default language to Brazilian Portuguese. With real-time message translation, you can engage customers from around the world, and all messages are automatically translated to and from Brazilian Portuguese—allowing you to operate more efficiently.

Education and language learning

Users who are learning a language can also greatly benefit from using real-time message translation. With a translation toggle added to a pre-built chat UI, someone from Botswana who’s learning Hindi can practice in the chat, and translate into their target language, while having the comfort of knowing that they can quickly check if they’re unsure. This can grow their confidence and help improve their overall language skills.

A chat message in Hindi, a button below the text reads ‘Translate this conversation to English’.

Healthcare

Fast and accurate diagnosis can be crucial in healthcare and medical settings to make sure that patients get the diagnosis and treatment they need. A medic in Tunisia can use a real-time translator app to get detailed, accurate information from someone who doesn’t speak Arabic. This way, healthcare professionals can support and offer effective care to all their patients, regardless of the patient’s primary language.

Shipping and logistics

Drivers and shippers can cross linguistic borders while speaking comfortably in their local language, using real-time translation. With translated message contents, a supplier in Panama can collaborate effortlessly with distributors and warehouse operators—whether they’re based in Manila, Dubai, or Rotterdam. Add to that chat UI localization, and you’re all set up for a global logistics operation.

Three TalkJS message interfaces, each with a message inquiring about shipment charges and the interface in a different language. The left shows the message and interface in English, the center one in Chinese (Simplified), and the right one in Arabic.Three chat windows are shown side-by-side, each showing the same message presented in three different languages.
Real-time translation and interface localization in a TalkJS chat

Travel and tourism

Travel and tourism operators can use real-time message translation on their website, or a real-time chat translation app to best support travellers on their journeys. For example, with the right tools, someone from Haiti visiting Iceland will be able to directly find their way and chat with locals on the streets of Reykjavík, gaining a fully immersive travel experience.

Benefits

Using real-time message translation can have the following benefits:

How to set up real-time message translation

In TalkJS, you can set up real-time message translation for your chat in just three simple steps, as follows.

Step 1: Get a Google Cloud Translation API key

TalkJS uses Google’s Cloud Translation API to integrate message translation into your chat. Begin by obtaining a Cloud Translation API key, if you don’t have one already: 

  1. Create a project in the Google Cloud Platform console, or navigate to your project if you already have one.
  2. Enable the Cloud Translation API for your project.
  3. On the API & Services Credentials page, select + Create credentials and choose API key.
  4. For your newly created API key, select the action Edit API key, and configure the key as follows:
    1. Name: Any name you want, for example ‘Real-time message translation’.
    2. Application restrictions: Select Websites.
    3. Website restrictions: Select + Add, enter https://app.talkjs.com, and select Done.
    4. API restrictions: Select Restrict key.
    5. Select APIs: Select Cloud Translation API.
    6. Select Save to save your changes.
  5. Enable billing for your project. Read more on how to enable billing for a project.

You now have a working Google Cloud Translation API key.

Step 2: Add your API key

Next, add your Cloud Translation API key to your TalkJS dashboard:

  1. Go to your Google Cloud APIs & Services credentials page.
  2. For your Cloud Translation API key, choose Show Key, and copy the key.
  3. Go to the Settings page of your TalkJS dashboard
  4. In the Localization section, paste your API key in the field under the heading Google translate API key
  5. Select Save localization settings to save your changes.
The localization section on the TalkJS dashboard, with the field to add the Google translate API key.

Your Cloud Translation API key has now been added to your TalkJS project.

Step 3: Enable real-time translation

Finally, enable translation in your chat. Translation settings are set per chat component, giving you full control over when translation is turned on or off. Here’s an overview of some of the options you have available, using the JavaScript SDK.

Translation option Description Code example
Show a translation toggle in the UI To show a translation toggle, you can pass one of the following values for showTranslationToggle when creating a chat UI:
  • true: show a translation toggle in all conversations
  • false: don’t show a translation toggle in conversations
  • auto: only show a translation toggle when participants in the conversation have different locales
const chatbox = session.createChatbox({ showTranslationToggle: 'true', });
Translate selected conversations To translate only selected conversations, you can pass an array of conversation IDs to translateConversations when creating a chat UI. const chatbox = session.createChatbox({ translateConversations: ['conv_1', 'conv_2'], });
Automatically translate any multilingual conversation To translate any conversations in which participants have different locales, you can pass 'auto' to translateConversations when creating a chat UI. const chatbox = session.createChatbox({ translateConversations: 'auto', });
Set translation for all conversations To set the translation for all conversations, you can pass the following values to translateConversations when creating a chat UI:
  • true: translate all conversations
  • false: don’t translate conversations
const chatbox = session.createChatbox({ translateConversations: true, });

You’ve now set up real-time translation for your chat.

Read more on enabling real-time translation with the JavaScript SDK, or check out further set-up and customization options with Talk JS tutorials.

How much does real-time message translation cost?

Real-time message translation is included in the TalkJS Growth and Enterprise plans at no extra charge. That said, Google does charge for use of the Cloud Translation API. Here is an overview of Cloud Translation pricing for different translation options.

Translation option Purpose Price (in USD)
AutoML Translation Model Training Operations Train custom translation models using your own datasets $45.00 per hour
AutoML Translation Online Predictions Operations Translate text in real-time using your own custom models

Tier 1
$80.00 per 1M count. Starting after: 0 count per month.

Tier 2
$60.00 per 1M count. Starting after: 250M count per month.

Tier 3
$40.00 per 1M count. Starting after: 2.5B count per month.

Tier 4
$30.00 per 1M count. Starting after: 4B count per month.

AutoML Translation Model Online Prediction In Translation V3 Document Translation Translate documents using your own custom models, using the Translation API V3 $0.25 per count
Language Detection Automatically identify the language of a given text $20.00 per 1M byte
Adaptive MT Translation Input Characters Translate text using Adaptive Machine Translation (MT), which adjusts translations based on user feedback, with charges based on input characters $25.00 per 1M count
Adaptive MT Translation Output Characters Translate text using Adaptive Machine Translation (MT), which adjusts translations based on user feedback, with charges based on output characters $25.00 per 1M count
Neural Translation Model Predictions Translate text using Neural Machine Translation (NMT) models $20.00 per 1M count
Neural Translation Model Predictions In Translation V3 Translate text using Neural Machine Translation (NMT) models from the Translation API V3 $20.00 per 1M count
Translation LLM Input Characters Translate text using the Translation Large Language Model (LLM), with charges based on input characters $10.00 per 1M count
Translation LLM Output Characters Translate text using the Translation Large Language Model (LLM), with charges based on output characters $10.00 per 1M count
Neural Translation Model Online Prediction In Translation V3 Document Translation Translate documents using Neural Machine Translation (NMT) models from the Translation API V3 $0.08 per count
💡
Prices for the Google Cloud Translation API listed here are confirmed accurate as of January 2025. Check the Google Cloud Price List for the latest pricing details.

Break the language barrier for your users

By removing language barriers you can  scale your operations globally. With TalkJS’ chat UI localization and integrated real-time message translation you’ll give your users a better chat experience—and all the while save time and costs. 

Are you ready to get started with real-time translation? Try TalkJS for free.

Read next

Effortless mentions
Product ·

Effortless mentions

Mentioning someone in a chat just became more effortless. Users no longer need to manually select, or hit enter or tab to mention another user in a conversation.