[Solved] Show alerte title in current language

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

[Solved] Show alerte title in current language

Post by Pixchel »

Hey, I got Dialogue System since a will now... but not really go trought :roll:
Now i'm going to do something with, I try to integrate language system from Localization package.

Everything work fine... hum or not.
I've tryed to take out something with your menu framework to make a custom setting menu like changing post process volume or manage weather quality etc... but for the language it a bit more complicated lol

Sometime when I load a game (start in french ) I back it set back to english (all others things are still in french using localization, english is the default language) -- I think it can come from the localization setting under the display setting from dialogue manager it's not set to fr but to FR-fr (in localization table it's fr) but not sure.

Other things is that, can we show the alert title in french too ? to here it's a script command that exectue and show it or the increment on destroy who use [var=enemiesKilled]/5 killed] for alerte.... but in private hart dialogue it's set to " Variable["Alert"] = "Mission: Get the Launch Codes" "

Any chance to have it in the current selected language too ?

Sorry for my english, I'm french ahaha..

Best regards. Pixchel.
Last edited by Pixchel on Sat Jul 06, 2024 2:51 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show alerte title in current language

Post by Tony Li »

Hi,

1. Assign a Text Table asset to the Dialogue Manager's Display Settings > Localization Settings.

2. In this Text Table, add a field "Mission: Get the Launch Codes" and translate it.

3. If you're using the Localization Package integration, you can use it to translate the Text Table asset.

The Dialogue System will use the field in the text table that matches the alert text.
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

Re: Show alerte title in current language

Post by Pixchel »

Thanks for your reply... I think for this problem
Sometime when I load a game (start in french ) it set back to english (all others things are still in french using localization, english is the default language) -- I think it can come from the localization setting under the display setting from dialogue manager it's not set to fr but to FR-fr (in localization table it's fr) but not sure.
was about the language table who have 3 field (default, en, fr) peraph I use only default and fr (in option, index are 0 - 1) but don't know why, I removed en to keep default and fr, but when I restart unity, en is back...

For the option, your answer is veryhelpfull, and I want to know how to refresh all dialogue system field when we swap the language. I mean in the quest tracker, it's not updated immediatly when I change en to fr, or fr to en using this code :

Code: Select all

public virtual void SetLanguageByIndex(int index)
        {
            if (DialogueManager.DisplaySettings.localizationSettings.textTable == null) return;
            var language = string.Empty;
            var languageList = new List<string>(DialogueManager.DisplaySettings.localizationSettings.textTable.languages.Keys);
            if (0 <= index && index < languageList.Count)
            {
                language = languageList[index];
            }
            var uiLocalizationManager = FindObjectOfType<UILocalizationManager>();
            if (uiLocalizationManager == null) uiLocalizationManager = gameObject.AddComponent<UILocalizationManager>();
            uiLocalizationManager.currentLanguage = language;
			uiLocalizationManager.UpdateUIs(language);
            Localization.language = language;
            DialogueManager.SetLanguage(language);
			LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[index];
			PlayerPrefs.SetInt(languagesPrefsKey, index);
        }
in option.cs

I need to speak with a npc or open dialogue quest window

Best Regards, Pixchel.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show alerte title in current language

Post by Tony Li »

Hi,

DialogueManager.SetLanguage() should update everything. But, if not, try calling DialogueManager.SendUpdateTracker() afterward.
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

Re: Show alerte title in current language

Post by Pixchel »

Thanks, it worked very well 8-)
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show alerte title in current language

Post by Tony Li »

Happy to help!
Post Reply