/ SDKs / Unity
SDKs
Chat SDKs Unity v4
Chat SDKs Unity
Chat SDKs
Unity
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 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 on-demand message translation 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 or visit the language support page in Google Cloud Translation.

// The USER_MESSAGE argument below indicates a SbUserMessage object
// which represents an already sent or received text message.
List targetLanguages = new List { "es", "de" };
channel.TranslateUserMessage(USER_MESSAGE, targetLanguages, (inUserMessage, inError) =>
{
    string esTranslatedMessage = inUserMessage.Translations["es"]; // Spanish
    string deTranslatedMessage = inUserMessage.Translations["de"]; // German
});