Page 1 of 1

Live translations

Posted: Thu May 26, 2022 5:01 am
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

Re: Live translations

Posted: Thu May 26, 2022 12:41 pm
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}");
}

Re: Live translations

Posted: Thu May 26, 2022 3:19 pm
by jmnb
Thanks for the tip! :)

Re: Live translations

Posted: Thu May 26, 2022 3:36 pm
by Tony Li
Happy to help!