GlobalWebIndex / elm-plural-rules / PluralRules.Cz

Czech is not so simple wrt. pluralization compared to English: it uses almost the whole gamut of Cardinals. So our defaultPluralize function is just identity and instead we rely on all pluralized words being present in the Rules dictionary.

The toCardinal function in this module is doing much more than in the English module, as the rules are more complex.

Usage

Create a Rules dictionary and a helper function that provides that dictionary to the fromInt function.

Over the course of development, as you add more usages of the pluralize function, add those words into your Rules dictionary.

You can look at the examples/ folder for the intended usage.

pluralize : PluralRules.Rules -> Basics.Int -> String -> String

Pluralization function for Czech rules (doing nothing in the general case).

Make your own helper function that gives pluralize your rules, so that you don't need to mention them every time!

(See the examples/ folder.)

myPluralize : Int -> String -> String
myPluralize n word =
    PluralRules.Cz.pluralize rules n word

pluralizeFloat : PluralRules.Rules -> Basics.Float -> String -> String

A Float variant of pluralize.