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

SmartFormat a list, with nested conditional formatter

Discussion in 'Localization Tools' started by fattak, May 11, 2022.

  1. fattak

    fattak

    Joined:
    Dec 23, 2018
    Posts:
    3
    Hi, I want to use the following to format a list using SmartFormat,

    "{Names:l:{}|, | {Not:nor|or} }"

    Names is a list of string
    Not is a boolean

    It's giving a result like "John, Mary Amy", expecting "John, Mary nor Amy"

    Can I nest the conditional (Not) formatter inside the list formater?

    Thanks for any help.
     
  2. karl_jones

    karl_jones

    Unity Technologies

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

    At the moment the spacers are treated as literal text so don't support formatting. This seems like something we could support so ill look into getting it added in the future.
    For now, you will need to find an alternative approach. Perhaps inverting it into 2 versions like so?

    {Not:{Names:l:{}|, | nor }|{Names:l:{}|, | or } }
     
    Last edited: May 11, 2022
    fattak likes this.
  3. fattak

    fattak

    Joined:
    Dec 23, 2018
    Posts:
    3
    Hi,

    Thanks a lot for the speedy reply, it works!
     
    karl_jones likes this.