Different locales for audio/subtitles

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OceaneM
Posts: 9
Joined: Thu Apr 27, 2023 11:08 am

Different locales for audio/subtitles

Post by OceaneM »

Hello there!
I'm looking to set up a locale for text, and a locale for audio. They could be different in our project (for example having a conversation in english but having french subtitles). Is this supported? Is there a way to do this?

Thanks in advance
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different locales for audio/subtitles

Post by Tony Li »

Hi,

Audio usually uses entrytags. Let's say these two things are true:
  • Your database's default language is English, and you've also added localized text in French ("fr").
  • You have recorded audio in English.
To play the audio in English and show the subtitle text in French:

1. Name the English audio clips according to their entrytags, such as Player_7_42

2. In the Dialogue Manager's Default Sequence, use: AudioWait(entrytag)

3. Set the language to French: DialogueManager.SetLanguage("fr");

This will play the English entrytag audio and show subtitles in French.

If you later record audio for other languages, name them by their entrytaglocal values: Player_7_42_fr. Then change the sequencer command to: AudioWait(entrytaglocal)
OceaneM
Posts: 9
Joined: Thu Apr 27, 2023 11:08 am

Re: Different locales for audio/subtitles

Post by OceaneM »

Hi Tony, thank you for your help!
In our database we actually have all the audio and texts ready in the different languages.
What I meant was more to have 2 different locales settings and be able to change them in runtime. A player could decide to choose a locale for the audio that is different from the subtitles.

Could something link this be possible?
- DialogueManager.SetAudioLanguage("fr");
- DialogueManager.SetSubtitleLanguage("en");
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different locales for audio/subtitles

Post by Tony Li »

Hi,

Yes.

Use DialogueManager.SetLanguage("en") to set the subtitles to English.

Name your audio files like Player_7_42_en, Player_7_42_fr, etc.

Use a sequencer command like this to play audio:

Code: Select all

AudioWait(entrytag_[var=audioLanguage])
Then set the audioLanguage variable:

Code: Select all

DialogueLua.SetVariable("audioLanguage", "fr");
At runtime [var=audioLanguage] will be replaced by the variable value ("fr"), so if the entrytag is "Player_7_42" then the whole "entrytag_[var=audioLanguage]" will be "Player_7_42_fr".
OceaneM
Posts: 9
Joined: Thu Apr 27, 2023 11:08 am

Re: Different locales for audio/subtitles

Post by OceaneM »

Hi Tony, this is a genius idea.
Thank you for this I could have never thought this was possible! :D
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different locales for audio/subtitles

Post by Tony Li »

Glad to help!
Post Reply