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. Dismiss Notice

Question Smart way to check if LocalizedString is smart

Discussion in 'Localization Tools' started by Lingvist, Aug 18, 2022.

  1. Lingvist

    Lingvist

    Joined:
    Jul 17, 2020
    Posts:
    6
    Hi, there! I am trying to find a solution to my problem: my table is filled with smart and non-smart (stupid :D) strings. In order to make the game decide where to pass the arguments I need to check the smart status of the specific localized string. I've already visited the manual page and found the solution with the use of LocalizationEditorSettings, but I don't really liked the solution, so I want to make sure if there is some alternative to that.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
  3. Lingvist

    Lingvist

    Joined:
    Jul 17, 2020
    Posts:
    6
    Hmm...ok, I'll try that one
     
    karl_jones likes this.
  4. Piotrone

    Piotrone

    Joined:
    Mar 6, 2015
    Posts:
    36
    What is the code for that, please?

    Code (CSharp):
    1. private LocalizedString _localizedString;
    2.  
    3. _localizedString.GetLocalizedString().IsSmart;
    Doesn't work
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    You need to get the string table entry.

    Code (csharp):
    1. var entry = LocalizationSettings.StringDatabase.GetTableEntry(_localizedString.TableReference, _localizedString.TableEntryReference);
    2. Debug.Log(entry.IsSmart);