SmartFormat icon indicating copy to clipboard operation
SmartFormat copied to clipboard

using plural with :p: token not working with version 3 (working in version 2 )

Open fbregeon opened this issue 10 months ago • 1 comments

Hello,

i'm updating my SmartFormat package from version 2 to version 3.

Try this example in console app :

Toto toto = new Toto();
toto.strings.Add("a");
toto.strings.Add("b");
Console.WriteLine(SmartFormat.Smart.Format("{strings.Count:plural:aaa|bbb}", toto));

Console.WriteLine(SmartFormat.Smart.Format("{strings.Count:p:aaa|bbb}", toto)); // this line causes error in version 3 but working in version 2 

public class Toto
{
    public List<string> strings { get; set; } = new List<string>();
}```

Workaround is to use :plural:


Best regards.



fbregeon avatar Apr 10 '24 13:04 fbregeon

Great, thanks for updating to v3. This absolutely makes sense. Using the :plural: notation is not a workaround, but the standard in v3. See https://github.com/axuno/SmartFormat/blob/c48f7c6b6c3a7c321c687723b1b3e748b03da5ac/src/SmartFormat/Extensions/PluralLocalizationFormatter.cs#L68-L72

axunonb avatar Apr 10 '24 20:04 axunonb

Please re-open if there's anything left to do.

axunonb avatar Apr 28 '24 18:04 axunonb