Page 1 of 1

[Solved] Show alerte title in current language

Posted: Tue Jun 18, 2024 11:50 am
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.

Re: Show alerte title in current language

Posted: Tue Jun 18, 2024 12:11 pm
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.

Re: Show alerte title in current language

Posted: Thu Jun 20, 2024 11:11 am
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.

Re: Show alerte title in current language

Posted: Thu Jun 20, 2024 12:17 pm
by Tony Li
Hi,

DialogueManager.SetLanguage() should update everything. But, if not, try calling DialogueManager.SendUpdateTracker() afterward.

Re: Show alerte title in current language

Posted: Fri Jun 21, 2024 6:48 pm
by Pixchel
Thanks, it worked very well 8-)

Re: Show alerte title in current language

Posted: Fri Jun 21, 2024 9:12 pm
by Tony Li
Happy to help!