Page 1 of 1
How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 5:56 am
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.
Re: How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 8:30 am
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.
Re: How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 9:19 am
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?
Re: How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 10:35 am
by Tony Li
Hi,
What other information can I provide? What else do you need to know?
Re: How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 12:40 pm
by DryreL
Hi,
How can I integrate Google Translate for example? It will be automatically translated from English to other languages
Re: How to use translation API to work with Dialogue System?
Posted: Mon Oct 04, 2021 1:14 pm
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).