SmartFormat
SmartFormat copied to clipboard
using plural with :p: token not working with version 3 (working in version 2 )
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.
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
Please re-open if there's anything left to do.