Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Feature Request Access to Current Localized String

Discussion in 'Localization Tools' started by bharrison-sd, Oct 20, 2022.

  1. bharrison-sd

    bharrison-sd

    Joined:
    Sep 30, 2022
    Posts:
    3
    Hi - curious if we can expose

    LocalizedString.m_CurrentStringChangedValue

    to quickly retrieve the value of an already localized string. I know we can use the StringChanged event to listen for modification, but in most of our cases it's overkill and I'm just interested in passing the value along to another object. I'd also like to avoid GetLocalizedString() to eliminate redundant loads and remove the need for arguments on something that's already localized. Any reason we couldn't expose this value, or an alternative in mind?

    Much appreciated!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    Hi,

    m_CurrentStringChangedValue is only used when the StringChanged event is being used so wouldn't be much use if you aren't already using the StringChanged event. At the moment we don't have any internal caching unless you are using the StringChangedEvent. I'll add a task for us to look into supporting caching for GetLocalizedString so it doesn't need to load each time. We didn't add it originally because we need a clear point to initialize and shut down the LocalizedString or it could leak the operation and prevent the assets from being unloaded. The StringChangedEvent was used to do this but we have since made improvements in this area though so should be able to better handle this now.
     
  3. bharrison-sd

    bharrison-sd

    Joined:
    Sep 30, 2022
    Posts:
    3
    Awesome, thanks. Looking forward to hearing more if you're able to do something there.
     
    karl_jones likes this.