# `VerifiedTranslations.Plural`
[🔗](https://github.com/treathealth/verified_translations/blob/v0.1.1/lib/verified_translations/plural.ex#L1)

CLDR plural rules, compiled from the bundled `priv/cldr/plurals.json`
(cardinal: 1 file, 2 files) and `priv/cldr/ordinals.json` (ordinal: 1st,
2nd), CLDR 49, Unicode License v3.

    iex> VerifiedTranslations.Plural.category("fi", 1)
    "one"
    iex> VerifiedTranslations.Plural.category("ru", 22)
    "few"
    iex> VerifiedTranslations.Plural.category("en", 22, :ordinal)
    "two"
    iex> VerifiedTranslations.Plural.categories("ar")
    ["zero", "one", "two", "few", "many", "other"]

Counts may be integers, floats, `Decimal`s or numeric strings ("1.50"
keeps its two visible fraction digits, which matters in some languages).

# `categories`

```elixir
@spec categories(String.t(), :cardinal | :ordinal) :: [String.t()]
```

CLDR plural categories of a CLDR language, in canonical order. `type` is
`:cardinal` (1 file, 2 files) or `:ordinal` (1st, 2nd).

# `category`

```elixir
@spec category(String.t(), number() | String.t() | struct(), :cardinal | :ordinal) ::
  String.t()
```

Plural category of `count` for a CLDR language (see `language/1`).

# `language`

```elixir
@spec language(String.t()) :: String.t() | nil
```

The CLDR language whose rules apply to `locale` (`"pt_PT"` -> `"pt-PT"`,
`"fi_FI"` -> `"fi"`), or `nil` when CLDR has no rules for it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
