/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Translate messages on-demand

Copy link

You can add a feature to your app to translate select messages into other languages. Using the channel.translateUserMessage() method, you can translate a text message already sent to a channel into the desired languages based on your own needs. To enable this feature, contact our sales team.

Note: Sendbird's message on-demand feature is powered by Google Cloud Translation API recognition engine. You can find the language codes supported by the engine in the translation engine page. You can also visit the language support page in Google Cloud Translation.

JavaScriptTypeScript
const targetLanguages = ['es', 'de']; // Spanish and German.
const message = await channel.translateUserMessage(USER_MESSAGE, targetLanguages);

const esTranslatedMessage = message.translations['es']; // Spanish.
const deTranslatedMessage = message.translations['de']; // German.