Page 1 of 1

Can I use LocalizeUI's 'Field Name' for localize & update?

Posted: Wed Aug 28, 2024 2:35 pm
by wlchfl5359
Hi,

I was changing text like

titletext.text = DialogueManager.GetLocalizedText(_data.taskName);

But I figured out it doesn't change language when I use DialogueManager.SetLanguage("english");
So I had to use this method "titletext.text = DialogueManager.GetLocalizedText(_data.taskName);" again to refresh it.

So I used LocalizeUI like this

localizeUnitName.fieldName = _data.taskName;
localizeUnitName.UpdateText();

Now it works well when I change language.

But I wonder whether this way changing Field Name is good way to change language.

Thank you.

Re: Can I use LocalizeUI's 'Field Name' for localize & update?

Posted: Wed Aug 28, 2024 2:52 pm
by Tony Li
Hi,

Are you using the current version of the Dialogue System? If so, then DialogueManager.SetLanguage("english") should tell all LocalizeUI components to update their texts according to the LocalizeUI's current field name.

When you set up the LocalizeUI component, you can specify a field name. If you leave the field name blank, LocalizeUI will use the text component's starting text value as the field name.

If you want to change the field name, you can use the code you showed above.

Re: Can I use LocalizeUI's 'Field Name' for localize & update?

Posted: Wed Aug 28, 2024 3:35 pm
by wlchfl5359
Oh, I'm using 2.2.39 now and I will update now.

I set some text like this titletext.text = DialogueManager.GetLocalizedText(_data.taskName) and use it for character name or something else.

Field name is default text.

Then I change languages, it doesn't change because text is now localizedText.

field name is still same.

Other texts that I set in the inspector changes well.

So I should set text again or set Field Name instead TMP text at first.

Then it changes well.

Re: Can I use LocalizeUI's 'Field Name' for localize & update?

Posted: Wed Aug 28, 2024 3:49 pm
by Tony Li
Hi,

Yes, that's correct. In that case, the best approach is to set the field name and then call UpdateText().