Skip to content

Commit

Permalink
Update PluralRules.cs
Browse files Browse the repository at this point in the history
Fixed version of Czech PluralRule with support of fractions.
  • Loading branch information
alexheb committed Dec 13, 2022
1 parent 82a91b6 commit fcf2d0f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/SmartFormat/Utilities/PluralRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,12 @@ private static int GetWordsCount4Value(decimal n)
_ => 5 // other
};
private static PluralRuleDelegate Czech => (value, pluralWordsCount) =>
value switch
{
0 => 0, // zero
1 => 1, // one
> 1 and < 5 => 2, // few
_ => 3 // other
};
value == 0 ? 0 : // zero
value == 1 ? 1 : // one
value.Between(2, 4) ? 2 : // few
value % 1 == 0 ? 3 : // many
4; // other

private static PluralRuleDelegate Welsh => (value, pluralWordsCount) =>
value switch
{
Expand Down

0 comments on commit fcf2d0f

Please sign in to comment.