Live translations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Live translations

Post by jmnb »

I'm making a multi-lingual app with the Dialogue System. I've added extra languages using the Template tab of the Dialogue System in the Unity editor. This is fine for changing the language of the dialogue, which you can do using the DialogueSystemController.SetLanguage method. But the ConversationState class (which stores the current conversation text) only contains text for the current language.

What I would like to do is to provide the ability to translate the text, which means I need access to all the different languages - not just the one that is set using the DialogueSystemController.SetLanguage method.

Any clue on how to set this up??? Thanks! :P
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Live translations

Post by Tony Li »

Hi,

To get the default text and other language fields, use the ConversationState's subtitle.dialogueEntry property. Example using an OnConversationLine method:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    DialogueEntry entry = DialogueManager.currentConversationState.subtitle.dialogueEntry;
    Debug.Log("Original dialogue text: {entry.DialogueText}");
    string spanishDialogueText = Field.LookupValue(entry.fields, "es");
    string spanishMenuText = Field.LookupValue(entry.fields, "Menu Text es");
    Debug.Log("Spanish dialogue text: {spanishDialogueText}");
    Debug.Log("Spanish menu text: {spanishMenuText}");
}
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Live translations

Post by jmnb »

Thanks for the tip! :)
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Live translations

Post by Tony Li »

Happy to help!
Post Reply