Search Unity

How to get pseudo localization to work for strings retrieved in code?

Discussion in 'Localization Tools' started by felixmann, Feb 28, 2021.

  1. felixmann

    felixmann

    Joined:
    Feb 16, 2017
    Posts:
    11
    I've set up pseudo localization and it works great for UI where I've used the LocalizeStringEvent MonoBehaviour.

    However, strings I retrieve via code don't seem to be pseudo localized:

    Code (CSharp):
    1. myStringTable.GetEntry(key).GetLocalizedString();
    Any ideas?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Yes the pseudo localization does not get applied at the table level but through the string database. If you are getting values through tables you can apply the pseduo localization yourself.

    GetEntry
    Code (csharp):
    1.  
    2. if (LocalizationSettings.SelectedLocale is PseudoLocale loc)
    3. {
    4. return loc.GetPseudoString(entry.GetLocalizedString());
    5. }
    Ill see if we can add support to the table in the future.
     
    felixmann likes this.
  3. felixmann

    felixmann

    Joined:
    Feb 16, 2017
    Posts:
    11
    Fantastic, thank you!
     
    karl_jones likes this.