Page 2 of 3
Re: How Can I Refresh UI Language After Change Language?
Posted: Wed Feb 22, 2023 11:09 am
by wlchfl5359
I just tried with new canvas and I added 'UI Localization Manager.cs' and it works!
I think I have a problem with my Dialogue Manager. I have only 1 UILocalizationmanager.cs but it doesn't work.
Re: How Can I Refresh UI Language After Change Language?
Posted: Wed Feb 22, 2023 11:13 am
by Tony Li
Hi,
That should be fine. The UILocalizationManager can be anywhere; it doesn't have to be on the Dialogue Manager.
Re: How Can I Refresh UI Language After Change Language?
Posted: Wed Feb 22, 2023 11:46 am
by wlchfl5359
I found a problem.
I was looking at code
public void UpdateUIs(string language)
{
m_currentLanguage = language;
if (saveLanguageInPlayerPrefs)
{
if (!string.IsNullOrEmpty(currentLanguagePlayerPrefsKey))
{
PlayerPrefs.SetString(currentLanguagePlayerPrefsKey, language);
}
}
var localizeUIs = m_alsoUpdateInactiveLocalizeUI
? GameObjectUtility.FindObjectsOfTypeAlsoInactive<LocalizeUI>()
: FindObjectsOfType<LocalizeUI>();
for (int i = 0; i < localizeUIs.Length; i++)
{
localizeUIs.UpdateText();
}
}
and I just turned off "Also Update Inactive Localize UI" and it works well.
I don't know why this happened.
Re: How Can I Refresh UI Language After Change Language?
Posted: Wed Feb 22, 2023 1:10 pm
by Tony Li
Hi,
I'll investigate that.
Re: How Can I Refresh UI Language After Change Language?
Posted: Thu Feb 23, 2023 12:47 am
by wlchfl5359
Thank you.
Please tell me if there is a problem.
Re: How Can I Refresh UI Language After Change Language?
Posted: Thu Feb 23, 2023 8:18 am
by Tony Li
I've confirmed that m_alsoUpdateInactiveLocalizeUI works correctly in a test scene. Can you send a
reproduction project to tony (at) pixelcrushers.com?
Re: How Can I Refresh UI Language After Change Language?
Posted: Mon Mar 27, 2023 4:14 pm
by elektronische
Hi, I have a question about the same topic. I'm using the method DialogueManager.Instance.SetLanguage to set the language when the user changes it from the options menu. This works correctly, but if a dialogue is active, the language does not change until the dialogue node ends and moves to the next one. Is there any way to make that UI update immediately? So that as soon as the player returns from the options menu, the subtitle language is already updated? Thank you!
Re: How Can I Refresh UI Language After Change Language?
Posted: Mon Mar 27, 2023 4:30 pm
by Tony Li
Hi,
If you're showing a subtitle, you can replay the same dialogue entry:
Code: Select all
var state = DialogueManager.converationModel.GetState(DialogueManager.currentConversationState.subtitle.dialogueEntry);
DialogueManager.conversationController.GotoState(state);
If you're showing a response menu, just call DialogueManager.UpdateResponses().
Re: How Can I Refresh UI Language After Change Language?
Posted: Mon Mar 27, 2023 4:55 pm
by elektronische
Tony Li wrote: ↑Mon Mar 27, 2023 4:30 pm
Hi,
If you're showing a subtitle, you can replay the same dialogue entry:
Code: Select all
var state = DialogueManager.converationModel.GetState(DialogueManager.currentConversationState.subtitle.dialogueEntry);
DialogueManager.conversationController.GotoState(state);
If you're showing a response menu, just call DialogueManager.UpdateResponses().
Thanks for the quick response!
Is this the only way? I ask because besides the subtitles, I also use sequences in the dialogue nodes that trigger other things like sounds, animations, etc. So it doesn't seem very efficient to replay the entire dialogue node just to update the subtitles' language.
Re: How Can I Refresh UI Language After Change Language?
Posted: Mon Mar 27, 2023 6:31 pm
by Tony Li
You could tell the subtitle panel to update its content:
Code: Select all
var subtitle = DialogueManager.currentConversationState.subtitle;
subtitle.formattedText = FormattedText.Parse(subtitle.dialogueEntry.currentDialogueText);
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);