Custom Solution - Read All Subtitle / Dialogue Text From Json at Runtime for Localization
Posted: Fri Oct 18, 2024 9:40 am
I'm working with an SDK and platform that requires a language json file and specific format. (Tony, you probably know the one)
The format goes:
I'll have to swap languages when their SDK function is called. I can do that using
, but I'm stuck trying to call the json at runtime. I've set up 'es' as a template field type Localization, but I won't be implementing the localized text this way. The platform will be translating and uploading the text. They need my solution to read the json using their language code to point at the right localized text.
My key question is how do I set all conversation lines to the localized text language the user selects before the gameplay starts? The option to swap is already given before any dialogue begins.
Here's an example of the keys and values I use in the json file:
I'm incrementing a string on each line of dialogue using a sequencer command because it has to sync up with the SDK's Text-to-Speech.
To vet my own question... here's my steps (thinking out loud here)
- Load DialogueDatabase
- MainMenu loads
- The user selects a language
- TDS DialougeManager.SetLanguage(languageKey) updates the key (ex: from "en" to "es")
- The DialolgueDatabase or separate solution using Subtitle Text reads the keys and values from language.json
- All dialogue in conversations now displays the localized text read from the .json file provided by the platform's team
- For testing (as per the requirements) if the key's value is "" (blank) it will display no text in the subtitle text
Thanks in advance for your help. Let me know if I should share any more info. Not sure how much I can actually share without having to read the contract though.
The format goes:
Code: Select all
{
"_meta": {
"maxChars": {
"welcome": 50
}
},
"en": {
"welcome": "Welcome"
},
"es": {
"welcome": "Bienvenido"
}
}
Code: Select all
DialogueManager.SetLanguage(languageKey);
My key question is how do I set all conversation lines to the localized text language the user selects before the gameplay starts? The option to swap is already given before any dialogue begins.
Here's an example of the keys and values I use in the json file:
Code: Select all
"intro7": "Press the Down Arrow Key to activate Teds cold power.",
"intro8": "Great job! You’ve frozen the little guy! It’s now a solid state slime.",
"intro9": "Look at the Micro Cam.",
To vet my own question... here's my steps (thinking out loud here)
- Load DialogueDatabase
- MainMenu loads
- The user selects a language
- TDS DialougeManager.SetLanguage(languageKey) updates the key (ex: from "en" to "es")
- The DialolgueDatabase or separate solution using Subtitle Text reads the keys and values from language.json
- All dialogue in conversations now displays the localized text read from the .json file provided by the platform's team
- For testing (as per the requirements) if the key's value is "" (blank) it will display no text in the subtitle text
Thanks in advance for your help. Let me know if I should share any more info. Not sure how much I can actually share without having to read the contract though.