Page 1 of 1
Different locales for audio/subtitles
Posted: Fri Aug 11, 2023 10:13 am
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
Re: Different locales for audio/subtitles
Posted: Fri Aug 11, 2023 10:55 am
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)
Re: Different locales for audio/subtitles
Posted: Fri Aug 11, 2023 11:41 am
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");
Re: Different locales for audio/subtitles
Posted: Fri Aug 11, 2023 12:02 pm
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".
Re: Different locales for audio/subtitles
Posted: Fri Aug 18, 2023 9:26 am
by OceaneM
Hi Tony, this is a genius idea.
Thank you for this I could have never thought this was possible!
Re: Different locales for audio/subtitles
Posted: Fri Aug 18, 2023 9:52 am
by Tony Li
Glad to help!