This is not exactly a built-in solution, but there's a Visual Studio extension, ReswPlus (on Visual Studio Marketplace), that leverages PluralNet and produces methods taking a number as argument to automatically choose the correct plural form for a given localization.
Here's an excerpt from the README about pluralization:
The resources:
| Key | Value | Comment |
|-------------------|------------------|-------------------|
| MinutesLeft_One | {0} minute left | #ReswPlusTyped[Q] |
| MinutesLeft_Other | {0} minutes left | |
Will automatically generate the following code:
#region MinutesLeft
/// <summary>
/// Get the pluralized version of the string similar to: {0} minute left
/// </summary>
public static string MinutesLeft(double number)
{
return Huyn.PluralNet.ResourceLoaderExtension.GetPlural(_resourceLoader, "MinutesLeft", (decimal)number);
}
/// <summary>
/// Format the string similar to: {0} minute left
/// </summary>
public static string MinutesLeft_Format(double pluralCount)
{
return string.Format(MinutesLeft(pluralCount), pluralCount);
}
#endregion