How to use translation API to work with Dialogue System?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
DryreL
Posts: 29
Joined: Sat Dec 26, 2020 1:58 pm

How to use translation API to work with Dialogue System?

Post by DryreL »

Hello there,

As I mentioned in the title, how can we integrate translation systems such as Google Translate, Yandex Translate or Microsoft Translator into our game in an easy way? Do you plan to bring such an update?

Thanks.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to use translation API to work with Dialogue System?

Post by Tony Li »

Hi,

To translate dialogue text, add a script to the Dialogue Manager that has OnConversationLine and OnConversationResponseMenu methods. For example:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    subtitle.formattedText.text = YourTranslationAPI(subtitle.formattedText.text);
}

void OnConversationResponseMenu(Response[] responses)
{
    foreach (Response response in responses)
    {
        response.formattedText.text = YourTranslationAPI(response.formattedText.text);
    }
}

The LocalizeUI component is used to localize non-Dialogue System text, such as menu buttons. You can make a subclass of LocalizeUI and override the UpdateText() method to get the text from your translation system.
User avatar
DryreL
Posts: 29
Joined: Sat Dec 26, 2020 1:58 pm

Re: How to use translation API to work with Dialogue System?

Post by DryreL »

Hello, thanks for the info. But I need more details. Is there a more detailed explanation, documentation or video on how to integrate automatic translation systems into the Dialogue System?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to use translation API to work with Dialogue System?

Post by Tony Li »

Hi,

What other information can I provide? What else do you need to know?
User avatar
DryreL
Posts: 29
Joined: Sat Dec 26, 2020 1:58 pm

Re: How to use translation API to work with Dialogue System?

Post by DryreL »

Hi,

How can I integrate Google Translate for example? It will be automatically translated from English to other languages
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to use translation API to work with Dialogue System?

Post by Tony Li »

In my example code above, you could replace "YourTranslationAPI" with whatever call you need to make to get the translation (e.g., from Google Translate or wherever).
Post Reply