The Pluralizer allows you to use a noun in the correct form depending on a numeric value.
$ dotnet add package SimplePluralizerThe SimplePluralizer is a package written in C# that allows you to use a noun in the correct form depending on a numeric value.
The SimplePluralizer package supports the below environments:
The SimplePluralizer NuGet package is available on NuGet.org.
PM> Install-Package SimplePluralizer
Return a correct form for English:
var pluralizer = new Pluralizer("key", "keys");
string result1 = pluralizer.Format(1); // Result: "key"
string result2 = pluralizer.Format(2); // Result: "keys"
string result5 = pluralizer.Format(5); // Result: "keys"
In Polish, for example, endings in the genitive plural are not equal for all grammatical genders:
var pluralizer = new Pluralizer("klucz", "klucze", "kluczy");
string result1 = pluralizer.Format(1); // Result: "klucz"
string result2 = pluralizer.Format(2); // Result: "klucze"
string result5 = pluralizer.Format(5); // Result: "kluczy"