Alerts multi language

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Haytam95
Posts: 23
Joined: Sun Mar 15, 2020 5:56 pm

Alerts multi language

Post by Haytam95 »

Hello!

I'm making my game multilanguage (Dialogue System is just awesome) and i'm stuck at Alerts. How could i make them multilanguage?

I thought about making a conversation with all the possible alert messages and then set the Variable['Alert'] to the entry of that conversation that i need. That would be a correct aproach?

Thanks!

Ps: Sorry any typos, english isn't my main language
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts multi language

Post by Tony Li »

Hi,

You can assign a Text Table asset to the Dialogue Manager's Display Settings > Localization Settings field.

Before alerts are shown, the Dialogue System will check if the alert text has a translation in in the Text Table.

For example, if you show the alert "Saving game...", the Dialogue System will check the Text Table for a field named "Saving game..." and use the translation for the current language.

If you need to compose an alert at runtime, you can use DialogueManager.GetLocalizedText(string):

Code: Select all

string text = DialogueManager.GetLocalizedText("Earned") + " " + xp + " " + DialogueManager.GetLocalizedText("XP");
DialogueManager.ShowAlert(text);
User avatar
Haytam95
Posts: 23
Joined: Sun Mar 15, 2020 5:56 pm

Re: Alerts multi language

Post by Haytam95 »

Tony Li wrote: Sun Mar 15, 2020 6:32 pm You can assign a Text Table asset to the Dialogue Manager's Display Settings > Localization Settings field.
That's great, i didn't know that alerts would check for localization before displaying text. I didn't follow how to access to that menu. Is it in this window? Could you point me out with a picture please?



Thank you Tony
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts multi language

Post by Tony Li »

The alert message does not come from the dialogue database. Create a Text Table asset:

Image

(In the Project view, select Create > Pixel Crushers > Common > Text Table.)

Then add the field:

Image

Then show the alert (example):

Image
User avatar
Haytam95
Posts: 23
Joined: Sun Mar 15, 2020 5:56 pm

Re: Alerts multi language

Post by Haytam95 »

Thanks Tony!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts multi language

Post by Tony Li »

Glad to help!
Post Reply