[HOWTO] How To: Show Localized Alerts
Posted: Fri Jul 11, 2025 12:21 pm
When you show an alert message, such as using the ShowAlert(message) Lua function or using DialogueManager.ShowAlert(message) in C#, the Dialogue System will automatically check for a translation of the message in the text table asset that's assigned to the Dialogue Manager's Display Settings > Localization Settings > Text Table field.
However, in some cases you may need to include variable content in the message.
For example, say you want to show a message that the current conversant has joined the party. For example in English, it might look like:
"Tony Joined Party"
One way to do this using the ShowAlert() Lua functions is:
The only catch is that it will always put the conversant's display name first, such as "Tony Joined Party".
If another language uses a different type of word order -- such as "Ymunodd Tony â'r Blaid" in Welsh -- you will need to handle it differently. In this case, you can write a C# method such as:
Then add a text table entry "Conversant Joined Party" with values such as:
However, in some cases you may need to include variable content in the message.
For example, say you want to show a message that the current conversant has joined the party. For example in English, it might look like:
"Tony Joined Party"
One way to do this using the ShowAlert() Lua functions is:
Code: Select all
ShowAlert(Variable["Conversant"] .. " " .. GetTextTableValue("Joined Party")
If another language uses a different type of word order -- such as "Ymunodd Tony â'r Blaid" in Welsh -- you will need to handle it differently. In this case, you can write a C# method such as:
Code: Select all
void ShowConversantJoinedParty()
{
string formatString = DialogueManager.GetLocalizedText("Conversant Joined Party");
string message = string.Format(formatString, DialogueLua.GetVariable("Conversant").asString);
DialogueManager.ShowAlert(message);
}
- English: "{0} Joined Party"
- Welsh: "Ymunodd {0} â'r Blaid"