/ SDKs / Unreal
Chat SDKs Unreal v3
Chat SDKs Unreal
Chat SDKs
Version 3

Message auto-translation

Copy link

It's possible for text messages to be sent in different languages through Sendbird's auto-translation feature. When sending a text message, pass in a List of language codes to the SendUserMessage() to request translated messages in the corresponding languages.

Note: Message auto-translation is powered by Google Cloud Translation API recognition engine. Find language codes supported by the engine in the Languages supported for translation page or visit the Language Support page in Google Cloud Translation.

std::vector<std::wstring> targetLanguages;

SBDUserMessageParams params = SBDUserMessageParams()

channel->SendUserMessage(params, [](SBDUserMessage* userMessage, SBDError* error) {
    if (error != nullptr) {
        // Handle error.

You can retrieve translations of a message through the Translations property. This will return a Map containing the language codes and translations.

class MyChannelHandler : public SBDChannelHandler {
    void MessageReceived(SBDBaseChannel* channel, SBDBaseMessage* message) {
        if (message->message_type == SBDMessageType::User) {
            SBDUserMessage* userMessage = dynamic_cast<SBDUserMessage*>(message);
            std::wstring esTranslatedMessage = userMessage->translations[L"es"];
            std::wstring koTranslatedMessage = userMessage->translations[L"ko"];

            // Display translations in UI.

SBDMain::AddChannelHandler(UNIQUE_HANDLER_ID, new MyChannelHandler());