Problem with localization of dynamic text

Sorry for my poor English and programming skills :slight_smile:
I have a script that puts some text to the upgrade panel:

 public void Set(UpgradeData upgradeData)
    {
        upgradeNameText.text = upgradeData.Name;
}

It gets the text from here:

public class UpgradeData : ScriptableObject
{
    public string Name;
}

It works fine but now I need to localize this text
So I added to upgradeData this:

public class UpgradeData : ScriptableObject
{
    public string Name;
    public LocalizedString localeStringName;
}

and added to script this:

  public void Set(UpgradeData upgradeData)
    {
        upgradeNameText.text = upgradeData.Name;
        localizeNameStringEvent.StringReference = upgradeData.localeStringName;
    }

I added to my upgrade panel LocalizeStringEvent and I can see that it gets a key from upgradeData but the text is not changing (see attached picture). It should be replaced (at least I hope so) by a description but it does not work.
Could you help me?
What have I done to localize my upgrade panel?
Thank you

Does the Update String event contain a reference to text in the LocalizedString?
9446609--1325612--upload_2023-11-2_15-46-14.png

If you click the Localize option from the TextMeshPro context menu it will add a configured LocalizedStringEvent component and configure it for you.

1 Like

Bingo! I completely forgot about it :slight_smile:
Thank you so much!

1 Like