Skip to content

Commit

Permalink
Fixes #179
Browse files Browse the repository at this point in the history
  • Loading branch information
axunonb committed Jul 23, 2021
1 parent b8777a9 commit bd75a78
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/SmartFormat/Utilities/PluralRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,16 @@ public static class PluralRules
return -1;
};// Dual: one (n == 1), other
private static PluralRuleDelegate DualWithZero => (n, c) => n == 0 || n == 1 ? 0 : 1; // DualWithZero: one (n == 0..1), other
private static PluralRuleDelegate DualFromZeroToTwo => (n, c) => n == 0 || n == 1 ? 0 : 1; // DualFromZeroToTwo: one (n == 0..2 fractionate and n != 2), other
private static PluralRuleDelegate DualFromZeroToTwo => (n, c) =>
{
return c switch {
2 => n < 2 ? 0 : 1,
3 => n == 0 ? 0 : n < 2 ? 1 : 2,
4 => n < 0 ? 0 : n == 0 ? 1 : n < 2 ? 2 : 3,
_ => -1
};
};// DualFromZeroToTwo: one (n == 0..2 fractionate and n != 2), other

private static PluralRuleDelegate TripleOneTwoOther => (n, c) => n == 1 ? 0 : n == 2 ? 1 : 2; // Triple: one (n == 1), two (n == 2), other
private static PluralRuleDelegate RussianSerboCroatian => (n, c) =>
n % 10 == 1 && n % 100 != 11 ? 0 : // one
Expand Down

0 comments on commit bd75a78

Please sign in to comment.